>>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.
Thank you Hilmar.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement