On 2015-11-17 16:59, Joel Fischoff wrote:
What you're suggesting is fine, you just need to remember that it has
to be consistent, variable name-wise.  And that the calculation MUST
be a string.  Though I'd probably just use macro substitution.

I just ran the following in interactive VFP 9:

Cost = 100
tax = 14
overhead = 6
jones_total = "(Cost * (Tax/100)) + Overhead"
? &jones_total

or replace the last line with:

total_calc = "(Cost * (Tax/100)) + Overhead"
jones_total = &total_calc


Ran it again in a program file, still executed just fine.


Joel



Here's the twist. My current code is a multi-line segment. Something like

Cost = Qty * UnitCost
Tax_Cost = (Cost * Tax_Rate/100)
SubTotal = Cost + Tax
Overhead_Cost = SubTotal * (Overhead_Rate/100)
Markup_Cost = (SubTotal + Overhead_Cost) * (Markup_Rate/100)
Total_Cost = SubTotal + Overhead_Cost + Markup_Cost


The reason they're all multi-line is because they're each stored to show the calcs on screen and in a report.



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to