Help needed on Error number (87)

Hobby

New Member
Hai,

I am a beginner in progress.. Please help me in following situation.


define variable v-where as char.
assign v-where = "tbprihdr.price-id = 1234".

find first tbprihdr where price-id = 1234.
message price-id. /* the record is available in buffer. */

if v-where then message yes. /* this statement is not correct */

Is there any way to execute the above statement.? I am expecting v-where to be calculated at run-time and the if condition becomes true.

Thanks
 
You can only use expression in an IF which either are TRUE or FALSE or NULL ( undefined ). A character variable is never TRUE or FALSE. Plus, you can't store the expressions on variables.


Regards, RealHeavyDude.
 
What i am expecting is...first i assigned
v-where = "tbprihdr.price-id = 1234".

then i am finding fbprihdr where price-id = 1234.

so now the value of fbprihdr.price-id is 1234.
now what i want is a way to check whether the record i found now is satisfying the condition i gave in variable v-where..i agree v-where is a character.
i am looking for some other way in which the v-where will be evaluated using the buffer fbprihdr which is available..
 
You can't check a where criteria that is stored on a character variable against a record that is in a buffer with static buffers. The only way you can do this is with a dynamic buffer and the logic is more complex than just a one-liner.

You would need to parse the field names and values from the character variables and cross check with the values of the buffer fields of the records that is in the buffer. Something like ( using this interface as editor - so it's not syntax checked ):
DEFINE VARIABLE hBuffer AS HANDLE NO-UNDO.
DEFINE VARIABLE cFieldName AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFieldValue AS CHARACTER NO-UNDO.

ASSIGN hBuffer = BUFFER fbprihdr:HANDLE.

/* Your logic to parse the field names and values from the contents of the character variable */

IF STRING ( hBuffer:BUFFER-FIELD ( cFieldName ):BUFFER-VALUE ) = cFieldValue THEN ...
HTH, RealHeavyDude.
 
Thanks RealHeavyDude... i know the dynamic thing u where telling and it is not one line.. what i was trying to find is whether there is in-build progress function which does this. :)
 
No, but the other solution would be to put the test in a function and reference the function in the IF.
 
Back
Top