Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I was wondering if it is possible to drop fields in the script if they fit certain conditions. See example:
ID | A1 | A2 | A3 |
---|---|---|---|
1 | 12 | 10 | 0 |
2 | 23 | 44 | 0 |
3 | 3 | 5 | 0 |
4 | 14 | 23 | 0 |
So in this case I would like to drop field A3 because all values are 0.
something like:
IF(sum(A3)=0 THEN drop field A3 ENDIF
does not work.
Does anybody have an idea if this is possible? the goal is to limit the size of the document.
your help would be much appreciated.
regards
Peter
Michael Solomovich is correct in his response. If seeing some working code will help you out more, here is an example:
data:
load * inline [
ID,A1,A2,A3
1,12,10,0
2,23,44,0
3,3,5,0
4,14,23,0
];
sums:
load sum(A3) as sumA3
resident data;
let vSumA3 = PEEK('sumA3');
if $(vSumA3) = 0 then
drop field A3;
endif
drop table sums;
It is possible.
IF <condition> THEN
<some script>
ELSE
<another script>
END IF
In your case, you don't need the ELSE part
Michael Solomovich is correct in his response. If seeing some working code will help you out more, here is an example:
data:
load * inline [
ID,A1,A2,A3
1,12,10,0
2,23,44,0
3,3,5,0
4,14,23,0
];
sums:
load sum(A3) as sumA3
resident data;
let vSumA3 = PEEK('sumA3');
if $(vSumA3) = 0 then
drop field A3;
endif
drop table sums;
Yes this is exactly what i need.
Thanks to both of you!