Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I have a small issue with if and match in script with multiple similar values.
I am trying to create a flag with below conditions. I have a feild called Division. If this division value is from 0 to 8 then it is Complete and if it is from 4 to 8 then it is Fulfilled. I tried below.
A:
Load * inline[
Division,
0,
1,
2,
3,
4,
5,
6,
7,
8];
B:
Load *,
If(match(division,0,'1','2','3','4'),'fulfilled',
If(match(division,0,'1','2','3','4','5','6','7','8'),'complete')) as flag resident A;
Now here since division values are repeating for complete flag in front end it only shows values from 5 to 8 where as it should show from 0 to 8. For fulfilled the values are shown correctly.
Please help.
You cant assign two values to the same row. You need to duplicate your A rows for 0 to 4 or add an dimension table that associates two values for the Division 0-4 and one value for 5 - 8.
You could try this script. (Use the join if you want to duplicate Division entries rather than a link table.
A:
Load * inline[
Division,
0,
1,
2,
3,
4,
5,
6,
7,
8];
B:
//LEFT JOIN (A)
LOAD DivMin - 1 +IterNo() as Division, Flag
inline [
DivMin, DivMax, Flag
0, 4, Fullfilled
0, 8, Complete]
while DivMin - 1 +IterNo() <= DivMax;
Hello,
Anyone any update on the above scenario.
You cant assign two values to the same row. You need to duplicate your A rows for 0 to 4 or add an dimension table that associates two values for the Division 0-4 and one value for 5 - 8.
You could try this script. (Use the join if you want to duplicate Division entries rather than a link table.
A:
Load * inline[
Division,
0,
1,
2,
3,
4,
5,
6,
7,
8];
B:
//LEFT JOIN (A)
LOAD DivMin - 1 +IterNo() as Division, Flag
inline [
DivMin, DivMax, Flag
0, 4, Fullfilled
0, 8, Complete]
while DivMin - 1 +IterNo() <= DivMax;
Hello Vegar,
Thank you so much for your help.
Above solution is working.