IF statement Logic to check two values

Discussions about CSEntry
chalasa
Posts: 4
Joined: November 25th, 2014, 9:37 am

IF statement Logic to check two values

Postby chalasa » May 18th, 2017, 7:23 pm

Hey,

I am trying to have some logic which tries to check if the right value has been chosen in relation to another previous value.

From the attached documents you will see that there are a number of countries and each country may have 1 or more WPAs. What the logic in WPA_ID is trying to do is to check whether the WPA chosen is really matched with that particular country that was chosen earlier in the form. The logic is not working correctly, i am missing something kindly help.

I have attached my cspro docs and an excel sheet to help us understand it better.
Attachments
Coding CCPS.xlsx
Country Coding with WPAs
(10.09 KiB) Downloaded 41 times
CCPS Survey.zip
Survey
(12.44 KiB) Downloaded 45 times

noel
Posts: 15
Joined: June 16th, 2012, 7:32 pm

Re: IF statement Logic to check two values

Postby noel » May 19th, 2017, 4:43 am

Please try to replace

elseif country_id = 3 and $ <> 1 or $ <> 2 then
by
elseif country_id = 3 and !($ in 1,2) then

and

elseif country_id = 7 and $ <> 5 or $ <> 6 or $ <> 7 then

by

elseif country_id = 7 and !($ in 5:7) then

With these replacements, your syntax should work.


Return to “Entry”