Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NULLs in SPT result
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00603525
Message ID:
00603619
Vues:
19
>>>>select nvl(fname, space(30)) LastName...
>>>
>>>I was looking for a more generic solution. I have a lot of SQL pass through calls/statements and was trying to avoid modifying all of them to handle the NULLs. I even have one SPT command that has over 200 fields.
>>>
>>>I do have a Null2Mt procedure that goes through all the fields of a table and converts the NULLs to their respective empty values. Only thing is it seems to have a problem with the fields not having the propertype i.e. nField1 is type "C" when it should be type "N". And I haven't had time to debug it properly due to upcoming deadlines.
>>
>>Your way and my example are the only ways I know of. If you are not just browsing the results and are binding the fields to controls, you can modify your classes to set the NullDisplay property. I would put a DO CASE in the class Init to handle all the data types and what you want their NullDisplay values to be.
>
>The form controls are fine since we already set the null display property (good thing we did that when we subclasses the base classes.) These SPT commands are the ones I use for the application's report generator.
>
>I'll just have to spend some extra hours today to debug it. Otherwise I'll have to put a whole bunch of nvl() calls in the report generator (over 6000 lines of code).

How about using a UDF call in the report fields that passes the fieldname to a function. Have the function test the value for null. If null, return an empty string. Otherwise, just return the passed value back to the report. This will save you from having to use NVL() in the report fields and let you control all the report output from the function.

In all the report fields:

MyReportUDF(fieldname)

The UDF:
procedure MyReportUDF
lparameter tuValue
if pcount() = 0 or isnull(tuValue)
   return ''
endif
return tuValue
If you really want to show a blank date, just check the vartype of tuValue and return {} of null dates.
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform