Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
LOAD Category,
Loc,
mon,
tar_qty,
year,
ITPCDE,
ITPFCN,
ITPTCN,
fs1,
fs2,
fs3,
fs4,
fs5,
fs6,
fs7,
fs8,
fs9,
fs10,
fs11,
fs12,
fs13,
fs14,
ts1,
ts2,
ts3,
ts4,
ts5,
ts6,
ts7,
ts8,
ts9,
ts10,
ts11,
ts12,
ts13,
ts14,
FROM
(qvd);
I want to make another column using below part. i make fsize as a global variable.
IF fs1>0 then
fsize= fs1
ELSEIF fs2>0 then
fsize= fs2
.................
Hi,
please load all values into a resident table and then write an if to read them again from the resident table, selecting only the fs value you need. Then drop the resident table:
Temp:
LOAD Category,
Loc,
mon,
tar_qty,
year,
ITPCDE,
ITPFCN,
ITPTCN,
fs1,
fs2,
fs3,
fs4,
fs5,
fs6,
fs7,
fs8,
fs9,
fs10,
fs11,
fs12,
fs13,
fs14,
ts1,
ts2,
ts3,
ts4,
ts5,
ts6,
ts7,
ts8,
ts9,
ts10,
ts11,
ts12,
ts13,
ts14,
FROM
(qvd);
Data:
Load
Loc,
mon,
tar_qty,
year,
ITPCDE,
ITPFCN,
ITPTCN,
if(fs1>0, fs1,
if(fs2>0, fs2,
if(fs3>0, fs3,
if(fs4>0, fs4,
if(fs5>0, fs5,
if(fs6>0, fs6,
if(fs7>0, fs7,
if(fs8>0, fs8,
if(fs9>0, fs9,
if(fs10>0, fs10,
if(fs11>0, fs11,
if(fs12>0, fs12,
if(fs13>0, fs13,
if(fs14>0, fs14,0)))))))))))))) as fsize,
ts1,
ts2,
ts3,
ts4,
ts5,
ts6,
ts7,
ts8,
ts9,
ts10,
ts11,
ts12,
ts13,
ts14 resident Temp;
drop table Temp;
Hope this helps.
Hi,
You want to add one more column or create global variable.
Global variable means, How that value aggregated (max of fs1/fs2 , Sum of fs1/fs2...)
Regards,
Karthik
my problem is i only want to get one fs value from all 14. that s why i use if to select that value
how i can select one fs value among 14 and make a column of it?
You can use nested if conditions and get a single value as
load
Category,
Loc,
mon,
tar_qty,
year,
ITPCDE,
ITPFCN,
ITPTCN,
if(fs1>0,fs1,if(fs2>0,fs2,if(fs3>0,fs3...........))) as fsize from....;
now crate a variable
let vFsize=peek('fsize',-1);
Regards
Nitin
Hi,
please load all values into a resident table and then write an if to read them again from the resident table, selecting only the fs value you need. Then drop the resident table:
Temp:
LOAD Category,
Loc,
mon,
tar_qty,
year,
ITPCDE,
ITPFCN,
ITPTCN,
fs1,
fs2,
fs3,
fs4,
fs5,
fs6,
fs7,
fs8,
fs9,
fs10,
fs11,
fs12,
fs13,
fs14,
ts1,
ts2,
ts3,
ts4,
ts5,
ts6,
ts7,
ts8,
ts9,
ts10,
ts11,
ts12,
ts13,
ts14,
FROM
(qvd);
Data:
Load
Loc,
mon,
tar_qty,
year,
ITPCDE,
ITPFCN,
ITPTCN,
if(fs1>0, fs1,
if(fs2>0, fs2,
if(fs3>0, fs3,
if(fs4>0, fs4,
if(fs5>0, fs5,
if(fs6>0, fs6,
if(fs7>0, fs7,
if(fs8>0, fs8,
if(fs9>0, fs9,
if(fs10>0, fs10,
if(fs11>0, fs11,
if(fs12>0, fs12,
if(fs13>0, fs13,
if(fs14>0, fs14,0)))))))))))))) as fsize,
ts1,
ts2,
ts3,
ts4,
ts5,
ts6,
ts7,
ts8,
ts9,
ts10,
ts11,
ts12,
ts13,
ts14 resident Temp;
drop table Temp;
Hope this helps.
nice, I ll try. thanks
thanks, i ll try
thanks all of u . it s really a big help. now i have another problem. I want to get these data to current date. i have TRA_DATE in my currentstock.qvd. pls help again
Hi Dushan,
I'm afraid I do not understand. Could you please explain the details?
Thanks!