IF, THEN, ELSE

Meeting place for R&R customers and clients to share tips and ideas. Post your questions, messages or problems here.
Post Reply
ITSUPER
Posts: 1
Joined: Tue Oct 10, 2017 12:44 pm

IF, THEN, ELSE

Post by ITSUPER » Wed Jan 22, 2003 10:39 am

How can I check a field value and then multiply another field by 2 if it is the value I want? For example: I want to check if a value = 41, if it does then I want to multiply a corresponding field by 2 - I have tried - IIF (TEST_ID = 41, QTY*2), where test_id and qty are two different fields. I keep getting synatx errors. I am very new to RR and am desperatly seeking help. ____Thank__Kathy

kfleming
Posts: 5795
Joined: Tue Oct 10, 2017 12:44 pm

=> RE: IF, THEN, ELSE

Post by kfleming » Wed Jan 22, 2003 12:49 pm

You are almost there. When you use the IIF() function you need to specify two return values, one for the true condition and one for the false. Both return values need to be the same data type.____So for your expression you could use:__IIF(TEST_ID = 41,QTY*2,QTY)____So for TEST_ID 41 it would return qty*2 otherwise it would be just qty.__Or you could use__IIF(TEST_ID = 41,QTY*2,0)__to return a zero as the false value.____Hope this helps.______Kathleen__R&R Support

Post Reply