Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Loops and resident tables

Hi everyone.

Any help for this situation will be very preciated.

I need to read a resident table in each loop cycle, and when every loop ends, write a line in another resident table

I have done this, but the resulting resident table is empty

LET vFrom = Date(Now()-2); --> Starting date for the loop

LET vTo = Date(Now()); --> Ending date for the loop

LET vNow = vFrom; --> A flag to where am I

FOR vI = vFrom to vTo --> Loop

  basenew: --> The table I must create, adding a line in each loop cycle

       LOAD --> Load data from an existent/resident table "baseold"

            $(vNow) as day,

            service,

            if((isnull(cancel) or cancel >= $(vAhora)) and suscribe <= $(vNow), 1, 0) as status --> Set 1 or 0 depending of dates condition

       Resident baseold;

  vNow = Date('$(vNow)'+1);

NEXT;

What I expect to have in "basenew" are lines like this

day               | service          | status      |

2017-01-01    |  service 1       | 1             |

2017-01-01    |  service 2       | 0             |

.....


Thanks in advance

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In you script is:

basefin:

LOAD *

Resident basenew;

The auto-concatenate feature will add the rows to the existing basenew table. A new "basefin" table will not be created.

Later in the script:

DROP Table basenew;

If you don't want the autoconcatenate, add the "NoConcatenate" keyword.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

6 Replies
annafuksa1
Creator III
Creator III

could you post your app that we can see the data ?

Anna

Anonymous
Not applicable
Author

Sure. I have attached qvw to the original post. Thanks!

annafuksa1
Creator III
Creator III

Could you add from base.qvd ? it is not possible to reload it now

Anonymous
Not applicable
Author

Done again. Little adaptation to bypass some sensitive data.

Tks!

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In you script is:

basefin:

LOAD *

Resident basenew;

The auto-concatenate feature will add the rows to the existing basenew table. A new "basefin" table will not be created.

Later in the script:

DROP Table basenew;

If you don't want the autoconcatenate, add the "NoConcatenate" keyword.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

Anonymous
Not applicable
Author

Tanks Rob. Your hints really helped me.

Regards