NULL string [message #311] |
Thu, 19 October 2006 03:15 |
galdiolom
Messages: 3 Registered: October 2006 Location: Padova ITALIA
|
Junior Member |
|
|
Hi Mr. Marston,
these are two "stupid" questions for a professional programmer but, for an end-user like me (that like your works and applied it to a 'database' [ex Microsoft Access] to archiving my music library) are a little bit confusing:
1. I have a situation where, in some cases, last_name can be NULL so, when I'm trying to execute an $sql_select that have:
CONCAT(first_name, " ",last_name)
the result (obviously) is NULL.
Can I (and how) implement the control for this situation. I think the better place is in <table>.class.inc with _cm_formatData :
function _cm_formatData ($fieldarray)
// perform custom formatting before values are shown to the user.
{
if (!isset($fieldarray['person_name'])) {
// merge first_name and last_name into person_name
if (isset($fieldarray['first_name']) AND isset($fieldarray['last_name'])) {
$fieldarray['person_name'] = $fieldarray['first_name']
. ' '
. $fieldarray['last_name'];
} // if
} // if
return $fieldarray;
} // _cm_formatData
2. Is it possible with filepicker to access <subdirectories> of the <main> (picture) in you example?
Thank you in advance
Maurizio Galdiolo
|
|
|
Re: NULL string [message #312 is a reply to message #311] |
Thu, 19 October 2006 04:33 |
AJM
Messages: 2370 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
There are two possible solutions to problem number 1:
1(a) If you are using MySQL you can try CONCAT_WS instead of CONCAT. See the manual at http://dev.mysql.com/doc/refman/4.1/en/string-functions.html
1(b) You can do it manually in the _cm_formatData() method as you suggested.
As for problem number 2, the short answer is "not yet" as there is no mechanism to browse through hierarchies of directories. The idea is that each implementation looks for specific file types in a specific directory, and not look for "something" which may be "anywhere". You should really design your application so that particular files go in particular directories, then you won't have a need to go wandering around looking for anything.
Even if I did implement such a feature it would only look from the current directory downwards, and would not have the ability to look in directories below other subsystems.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: NULL string [message #314 is a reply to message #313] |
Thu, 19 October 2006 09:52 |
AJM
Messages: 2370 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Go to the data dictionary and look in the column details for that table. For numeric fields you will see columns for minimum and maximum values. This means that you cannot enter numbers which are outside of this range. You can adjust these values if you want, but you cannot use values which are too large for the size of the field as it is defined in the database.
After making any adjustments in the data dictionary you must run the 'Export to PHP' function in order to update the <table>.dict.inc file.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|