IF statement Logic to check two values

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
chalasa
Posts: 18
Joined: November 25th, 2014, 9:37 am

IF statement Logic to check two values

Post by chalasa »

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 295 times
CCPS Survey.zip
Survey
(12.44 KiB) Downloaded 291 times
noel
Posts: 25
Joined: June 16th, 2012, 7:32 pm
Location: Libreville, Gabon

Re: IF statement Logic to check two values

Post by noel »

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.
Post Reply