Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey guys,
I want to save a result during the script load into a new created field
Example: different checks leads to a summary if the test was ok or nok
So we have 3 Tests:
Test_1 = 1 ok , 0 nok
Test_2 = 1 ok , 0 nok
Test_3 = 1 ok , 0 nok
Only if all 3 tests are successfully then the complete result is ok otherwise the result is nok
I want to save two new fields with name "result_ok" and one with "result_nok"
if (Test_1 =1 AND Test_2 =1 AND Test_2 =1,'1','0') as result_ok, + want to save '0' in result_nok if result_ok is 0 or '1" in result_nok if result_ok is 1
something like
if (Test_1 =1 AND Test_2 =1 AND Test_2 =1, '1 as result_ok AND 0 as result_nok', '0 as result_ok AND 1 as result_nok')
I know that I can do a preceding load again to check the value of the result_ok and set then the result_nok
like:
load *,
if (result_ok=1,'0','1') as result_nok;
load *,
if (Test_1 =1 AND Test_2 =1 AND Test_2 =1,'1','0') as result_ok,
but is there a better way to do it in one if ... else statement or a better way to do it completely different?
Thanks
VoTo
You cannot create multiple fields with single if statement. You are doing correctly using Preceding load
Load *,
If(Test_1+Test_2+Test_3=3, 1, 0) As result_ok,
If(Test_1+Test_2+Test_3<3, 1, 0) As result_nok;
Load * inline [
Test_1,Test_2,Test_3
1,1,1
1,1,0
1,0,0
1,0,1
0,1,0
0,0,1
0,1,1
0,0,0
];