Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting 'one from' from percents field
Message
From
17/09/2006 15:00:11
 
 
To
15/09/2006 04:15:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01153992
Message ID:
01154487
Views:
10
>Hi all
>I have a cursor with 3 fields: product (c 2),percent (n 6,2) , onefrom (n 6,2).
>The cursor full with data in the two left columns and I have to feel the onefrom according to percent column (for examle if the percent is 20.00(%) the onefrom is 5).
>How can I do it?

Tore has given you the direct answer. However, it's better to not store calculated values like these in your database at all:

- if you ever change the Percent values, you have to remember to update the OneFrom values as well. If they ever get out of "sync" you'll likely have a mess.

- in your case you're storing OneFrom with only 2 decimals of precision. Suppose Percent = 15. Then OneFrom gets stored as either 6.67 or 6.66, either of which is likely to give significant rounding errors in calculations.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform