Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need references to rule definition languages
Message
From
20/11/2003 09:56:19
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
19/11/2003 18:10:57
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00851678
Message ID:
00851870
Views:
7
>I want to create a very flexible program to interpret employee key punches (in, out, and perhaps missing) and by using a schedule and a previously defined set of rules, calculate the different rates of pay applicable.

I don't know whether this is good enough for you, but I needed to do something similar once, where the user could insert user-defined calculations.

Basically, you can have a field (in a variable number of records) where the user types in a formula, VFP syntax.

With eval(), you can then evaluate those rules.

For a complete solution, you may want to have special variables, which you replace before you eval(): for instance, the expression row(5) might refer to the calculated value of the fifth row. That is, while you evaluate each row, you place the calculated values in an array.

Evaluating VFP expressions has its problems, too - it is difficult to avoid that the user access publicly available variables or methods, which you had only designed for internal use.

However, evaluating formulae with eval() is very flexible, and relatively easy to program.

HTH,

Hilmar.
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
Next
Reply
Map
View

Click here to load this message in the networking platform