Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I got a table to which I want to add 20 columns that take values 1 or 0
so suppose the load script is as such:
Load
Col1,
Col2
from....
How to accomplish something like
Load
Col1,
Col2,
For i=1 to 20
if (i%2=0 ,1,0) as Week & i
next
Please advise
Ali - Please can you explain the second bit again? Do you want to load dynamic number of columns or dynamic rows within those 20 columns?
Cheers,
DV
Hi ali_hijazi,
You can include news columns dynamically using left join with a table.
Table:
LOAD * INLINE [
Col1, Col2
a, i
b, h
c, g
d, f
e, e
f, d
g, c
g, b
h, a
];
FOR i = 1 to 20
vWeek = 'Week' & $(i);
LEFT JOIN (Table)
Load Col1,
Col2,
if( mod($(i),2)=0,1,0) as $(vWeek)
Resident Table;
NEXT
let vWeek =;
But why do you want to create so many columns in the script ?
Hope this helps you.
Regards