Hi,
I am trying to figure out which node to use to make a FLAG where the condition is IRR>=30 → FLAG=1.
my workflow is looping on the “plant” and every plant has its own number of IRR_ columns.
In my table, I can have 4 possibilities of having inside :
- one column called IRR_1
- 3 columns with IRR_1, IRR_2, IRR_3
- 6 columns with IRR_1,IRR_2,IRR_3,IRR_4,IRR_5,IRR_6
- 9 columns with IRR_1,IRR_2,IRR_3,IRR_4,IRR_5,IRR_6,IRR_7,IRR_8,IRR_9
but obviously, I don’t know when I will have which one it depends on the “plant”.
So the first point is to find the number of IRR_ columns and I have it, working with Extract header and Value Counter so at the end I have a column named count where I have a number of IRR columns in the table.
So I wanted to use the Column Expressions to make an IF statement and make this condition:
if(column(“count”)==1 & column(“IRR_1”)<= 30){
0
}
else if(column(“count”)==3 & column(“IRR_1”)<= 30
|| column(“IRR_2”)<= 30
|| column(“IRR_3”)<= 30) {
0
}
else if(column(“count”)==6 & column(“IRR_1”)<= 30
|| column(“IRR_2”)<= 30
|| column(“IRR_3”)<= 30
|| column(“IRR_4”)<= 30
|| column(“IRR_5”)<= 30
|| column(“IRR_6”)<= 30){
0
}
else if(column(“count”)==9 & column(“IRR_1”)<= 30
|| column(“IRR_2”)<= 30
|| column(“IRR_3”)<= 30
|| column(“IRR_4”)<= 30
|| column(“IRR_5”)<= 30
|| column(“IRR_6”)<= 30
|| column(“IRR_7”)<= 30
|| column(“IRR_8”)<= 30
|| column(“IRR_9”)<= 30){
0
}
else{
1
}
To get the FLAG which depends on number of the columns and also the value of IRR inside the table.
The error that occurs to me is:
"ERROR Column Expressions 4:9:2612:77:75 Execute failed: An error occurred in script 1:
Column ‘IRR_2’ is unknown."
In the loop where I am working, in my actual table, I have only one IRR_1 column so the if condition should stop on the first statement but it is not stopping and it proceeds to the second condition, I think, and this produces the error. How can I make it work? does Column Expressions consider also some “pass” statement if the condition doesn’t exist or it’s not satisfied?