Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditional Formatting of Field Values
Message
From
20/08/2008 13:38:37
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
20/08/2008 09:55:35
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01340331
Message ID:
01340432
Views:
11
>Ok, but the UDF would still be a series of CASE statements to return the correctly formatted field value, right?

Probably. One level of DO CASE for each type of field, a second level for each format defined for that type of field.

Unless you decide to use a data-driven approach: Instead of the CASEs, put the different options into a table, and your function just looks it up. That may save you re-compiling when you add a CASE. Actually, since you have some complicated formatting, in this case you probably would have to store the entire expression in a memo field, e.g. (for a date), something like this: trans(year(txValue)) + "-" + padl(month(txValue), 2, "0") + "-" + padl(day(txValue), 2, "0"). I did something similar for data validation, and it works quite well.
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)
Previous
Reply
Map
View

Click here to load this message in the networking platform