Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
prees959
Creator II
Creator II

Inline Load within Resident Load

Hi,

I am creating a number of QVDs within a loop and depending on which loop the current 'pass' is I want to write a value into the qvd.

For example.

DO WHILE counter < 3

TIMES:

load

    [KEY]


   if(counter =0 ,'AM',

    if(counter =1 ,'PM',

    if(counter =2 ,'ALLDAY')))    as TIME_TYPE,

   

    START_DATE,

    END_DATE

Resident LOAD1;

left join

load

STATUS_ID,

NAME,

STATUS_VALUE,

[KEY]

RESIDENT [STATUS];

counter=counter+1;

STORE TIMES INTO....;

DROP TABLE TIMES;

LOOP;

So, depending on what part of the loop the script is in, I want to reference this in the table I am creating.

I have tried the above If Statement - but I am getting an error.

Cananyone advise please?

Thanks,

Phil

1 Solution

Accepted Solutions
sunny_talwar

Couple of things...

1) Do you initiate your counter variable?

LET counter = 0

2) Use it like this may be

Pick($(counter) + 1 , 'AM', 'PM', 'ALLDAY') as TIME_TYPE

View solution in original post

3 Replies
sunny_talwar

Couple of things...

1) Do you initiate your counter variable?

LET counter = 0

2) Use it like this may be

Pick($(counter) + 1 , 'AM', 'PM', 'ALLDAY') as TIME_TYPE

maxgro
MVP
MVP

without if

for each timetype in 'AM', 'PM', 'ALLDAY'

     TIMES:

     load

           [KEY],

          '$(timetype)'  as TIME_TYPE,

         START_DATE,

         END_DATE

     Resident LOAD1;

     left join

     ......

next

prees959
Creator II
Creator II
Author

Perfect thanks!

Phil