If Statement/Operator Question

Warren Kuhl warrenkuhl at gmail.com
Thu Jul 23 09:20:09 EDT 2009


Is it possible to pass the operator as a variable. When I try, the code
doesn't seem to work. When I hardcode the operator, everything works fine.
The problem is the operator can be different depending on what the user
selects and I don't want to hardcode each condition if I don't have to.

Here is an example where tCondition1 could be =, >, >=, <, <=, etc.

When I try the following (tCondition1 is "="), I get no results....

if (item tField1 of line x of tdata) & tCondition1 & (field "S1 Compare 1
Field") then
Answer "This works"
delete line x of tdata
end if

When I try the following, I get results...

if (item tField1 of line x of tdata) = (field "S1 Compare 1 Field") then
Answer "This works"
delete line x of tdata
end if

Thanks for any help!
Warren



More information about the use-livecode mailing list