Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use MAX() in a calculated field?
Message
De
26/01/2007 09:32:37
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Stonefield
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01189404
Message ID:
01189568
Vues:
9
This message has been marked as a message which has helped to the initial question of the thread.
>>>>
>>>>You didn't accidentally multiply or divide, instead of subtracting?
>>>>
>>>
>>>No.
>>>
>>>>Also check the field width in the report, and the numeric format, e.g. "###" will show asterisks if you have four digits.
>>>
>>>I have no choice to specify how many digits to be printed in the column. Just the width of the column. But the values are very small (no more than 4 digits). And in fact when I was using simple DATE_FLD1 - DATE_FLD2 as an expression the number were showing without any problem. It is when I get the DATE_FLD1 - DATE_FLD2 from within IIF() the number are super large. Strange ...
>>
>>How about a cast().
>
>The same result, a bunch of asterisks. Thank you.

Dmitry,

Suggestions - may be wrong, since I do not know SDT
(1)
select eval('max(d2-d1, 0)')

(2) To get rid of the asterisks, force the field length
select ntom(eval('max(d2-d1, 0)')) from test

works as well
select mton(eval('max(d2-d1, 0)')) from test

and this also
select mton(eval('max(ntom(d2-d1), $0)')) from test
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform