Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determining field format in a table
Message
From
14/09/2011 14:19:59
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Determining field format in a table
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01523528
Message ID:
01523528
Views:
97
How can I determine the field definition in a table that is format, and then use that in a Transform() function.

Example: a field as N(5,2)

What I ultimately want achieve is getting a string version that field that is formatted to the same number of decimals.

Example, if the field is defined as N(5,2) and the values is 2.50, I want as string that reads “2.50”, if the value is 1.00, I want a string that is ”1.00”. But I cannot hard-code the number of decimals, it must come from the field definitions in the tables.

If it is an integer, then it will not have any decimals.

I must use the field data to determine the format of the string that I want to show in some html page I am building.

Right now, when I use the Transfrom() function, it will omit the decimals if the value is a whole number.

Transform(1.00) returns “1”, but I want “1.00”
Next
Reply
Map
View

Click here to load this message in the networking platform