Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use MAX() in a calculated field?
Message
De
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:
01189422
Vues:
13
This message has been marked as the solution to the initial question of the thread.
>Hi Everybody,
>
>I have included a calculated field in a table (using SDT). Then I use this calculated field in the Stonefield Reports.
>
>The calculated field is DATE_FLD1 - DATE_FLD2 and it works.
>
>But when I included the MAX in the calculated field as
>
>
>MAX((DATE_FLD1 - DATE_FLD2),0)
>
>
>I get error message about missing ")" in a function name.
>
>The error is generated by method ExecuteSqlSelect of class SfDataEngineVFP.
>
>This seems like a problem with SFReports and not with the MAX()used in the calculated field expression. Does this seem like the correct assumption?
>
>Thank you.

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)
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform