Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

please help

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

.................

1 Solution

Accepted Solutions
salto
Specialist II
Specialist II

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.

View solution in original post

14 Replies
Not applicable
Author

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

Not applicable
Author

my problem is i only want to get one fs value from all 14. that s why i use if to select that value

Not applicable
Author

how i can select one fs value among 14 and make a column of it?

Anonymous
Not applicable
Author

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

salto
Specialist II
Specialist II

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.

Not applicable
Author

nice, I ll try. thanks

Not applicable
Author

thanks, i ll try

Not applicable
Author

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

salto
Specialist II
Specialist II

Hi Dushan,

I'm afraid I do not understand. Could you please explain the details?

Thanks!