Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use MAX() in a calculated field?
Message
 
 
À
25/01/2007 18:35:36
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Stonefield
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01189404
Message ID:
01189424
Vues:
10
>max() and min() are always problematic in SQL - SELECT statements, because they have another meaning: the maximum value for a single field, within a set of grouped records.
>
>Replace it with an iif(), for example:
>
>
>iif(date_fld1 - date_fld2 > 0, date_fld1 - date_fld2, 0)
>
>
>... or create a UDF:
>
>
>MyMax(date_fld1 - date_fld2, 0)
>
When trying your first suggestion (with IIF) I get no error but the numbers are (for some reason) so large that the report shows all asterisks. Even though the numbers should not be large at all (as I see the values in date_fld1 and date_fld2). I would prefer not to use the UDF approach as it may not be available when user runs this or that report. I will keep trying the variations of IIF to see how I can get it to work.

Thank you very much for your help.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform