Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems in using the function EVALUATE()
Message
From
15/09/2017 01:14:08
Reza Meamar
Homa Programming Group
Shiraz, Iran
 
 
To
14/09/2017 17:31:04
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP3
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01654324
Message ID:
01654342
Views:
63
>>>>>Please create a sample with a cursor, then it's more realistic.
>>>>
>>>>
>>>>CREATE CURSOR MyCursor (HMF01 C(25), HMF02 C(25), HMF03 C(25))
>>>>INSERT INTO MyCursor (HMF01, HMF02, HMF03) VALUES ("m.KHour * 1100000 / 110", "1100000", "")
>>>>
>>>>m.KHour = 300
>>>>
>>>>FOR ncounter = 1 TO 3
>>>> STORE EVAL(EVALUATE("HMF" + PADL(ALLTRIM(STR(nCounter)),2,"0"))) TO nValue
>>>>
>>>> ? nValue
>>>>ENDFOR
>>>>
>>>>USE IN MyCursor
>>>
>>>This is a very good example of a very bad data design. Why store it that way????? If you have no control over this, then you must simply add a special handling of the first case.
>>
>>this is only an example :)
>>These three fields are actually different values that are calculated for different personnel.
>>Sometimes a staff member dose not takes a lot of money, sometimes takes a sum according to the formula and sometimes takes a fixed amount.
>
>If these are real samples, then the design it very bad in deed. For instance, you don't store a formula and/or variable names in a table. Period! You just don't!
>If the sample isn't realistic, please present a table/cursor with realistic values.

A friend at Foxite has suggested the following code
STORE EVALUATE(MAX(EVALUATE("HMF" + PADL(ALLTRIM(STR(nCounter)),2,"0")), "0")) TO nValue 
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform