Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi colleagues.
I'm working now with creating variable which will be used as IF statement in next load.
What is the idea?
I have simple table like:
ID_Cond | Condition | Category |
1 | Name=A | First |
2 | Name=B | Second |
3 | Name=C | Third |
what i need - create if statement with checking all ID_Cond values and corresponded Condition to set necessary Category, for example:
IF(ID=1 and Name='A', 'First',
IF(ID=2 and Name='B', 'Second',
... , 'non'))
I started to create this variable in loop, but stopped with appending to if statement in the loop (see example in the attachment).
Any idea how to correctly create this statement?
In result my variable should have this value:
'IF([ID_Cond]='1' and ([Name]='A'), 'First',
IF([ID_Cond]='2' and ([Name]='B'), 'Second',
IF([ID_Cond]='3' and ([Name]='C'), 'Third', 'Non') as NewField;'
Thanks/
Hi andreyfcdk91
what you can do is reload your table.
Table2:
load *,
IF([ID_Cond]='1' and ([Name]='A'), 'First',
IF([ID_Cond]='2' and ([Name]='B'), 'Second',
IF([ID_Cond]='3' and ([Name]='C'), 'Third', 'Non'))) as NewField
resident Table1;
drop table Table1; rename table Table2 to Table;
then you'll have a Table with the fields ID_Cond, Name and NewField.
i hope I helped you.
RS