Showing results for 
Search instead for 
Did you mean: 

Cannot find my syntax error in multiple If Statement

Cannot find my syntax error in multiple If Statement

I've struggled with this syntax for a few hours and if I can get it correct I will be using similar multiple if statements in the project. 
The main purpose is if the 2nd IF statement is true and populated with "All Match" then I wouldn't have to check the 3rd IF statement with 6 fields, I only need to check the 2nd IF statement comparing the 2 fields.  I am just not correct with the position of the )'s and ('s.
The error I am getting is under the last 4 )))) with a message Missing ')' at <EOF>

If (((@Country Match in Update@ = "All Match), 
        @COUNTRY_OF_SALE_GTIN_MATCH@ = @COUNTRY_OF_SALE_EAN_UCC13_MATCH@),"All Match","A Mismatch")))) 

Appreciate the help!
Labels (1)
0 Kudos
3 Replies

I noticed today this "create column" code is no longer showing an error (did nothing to change) but the new column is also not showing in the data display below.  Is there a limit to the number of columns that can be created and/or displayed? I wonder if that is why it is not showing an error as well as not showing the new column?
0 Kudos
Linear Actuator

For the statement above - my suggestion when you are running into errors for complex computed columns is to break them down into individual statements. This will allow you to test the logic in a more localized manner. When I did this with your example,  I saw a few things:

Statement #1 contains a syntax error and a missing element.  In looking at it, I see:
If (((@Country Match in Update@ = "All Match), 

It should be: If (((@Country Match in Update@ = "All Match"), "All Match"

That seems to be a consistent error in each of your statements.  The syntax is:

IF (test condition,"a","b"). You need to include the "a" for each IF clause. There should only be 1 "b", but for each IF, there needs to be a corresponding "a".  

In reviewing your statements, you are omitting the "a" at the end of each clause.  Your statement should look more like this:

IF(@Country Match in Update@  = "All Match",  "All Match",

The way Paxata will work is that for each record, we will evaluate the first condition in the statement. If it's a positive result, we stop looking, take the answer associated with the first statement, and then move to the next record.

If the first condition renders a negative response, we then move to the second statement and follow the same pattern. If the 2nd condition tests for true, we stop. Otherwise, Paxata then moves to the 3rd statement. If the 3rd statement is false, and there are no other statements, we then answer with the "b" response.

In terms of your question about max columns - that is dependent on your guardrail setting.  If you hit the max columns, you will receive an error message.  

Write each statement on its own, validate the logic, then try and merge them together.  

0 Kudos

Great advice, thanks Julie!
0 Kudos