>>Dear All,
>>I have below codes
>>
>>m.KHour = 300
>>
>>HMF01 = "m.KHour * 1100000 / 110 "
>>HMF02 = "110000"
>>HMF03 = ""
>>
>>FOR ncounter = 1 TO 3
>>STORE EVALUATE("m.HMF" + PADL(ALLTRIM(STR(nCounter)),2,"0")) TO nValue
>>
>>? nValue
>>ENDFOR
>>How should I use the EVALUATE() function to put a numeric value in the nValue variable?
>>
>>3000000 for HMF01
>>1100000 for HMF02
>>0 for HMF03
>>
>>Thank you for guiding
>
>Haven't read all the responses so this may be a duplicate.
>
>Running your original code I just got back the values in the variables rather than their evaluated values.
>So I tried
>STORE EVALUATE(EVALUATE("m.HMF" + PADL(ALLTRIM(STR(nCounter)),2,"0"))) TO nValue
>which gave a "Missing Expression" error
>
>I then tried
>
>m.KHour = 300
>
>HMF01 = "m.KHour * 1100000 / 110 "
>HMF02 = "110000"
>HMF03 = ""
>
>FOR ncounter = 1 TO 3
>STORE EVALUATE(EVL(EVALUATE("m.HMF" + PADL(ALLTRIM(STR(nCounter)),2,"0")),'0')) TO nValue
>
>? nValue
>ENDFOR
>
>and it seemed to work
Try with this aproach:
For lnCounter = 1 To 3
lcField = Evaluate(Field(m.lnCounter))
If !Empty(Alltrim(m.lcField))
lcResult = Evaluate(Evaluate(Field(m.lnCounter)))
? lcResult
Store m.lcResult To lnValue
Endif
Endfor
Regards,
Koen