Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
massimilianoruf
Partner - Contributor III
Partner - Contributor III

Partial Reload and variables

Hi all,

is the "for each" statement skipped during Partial Reload?

Edit: the problem wasn't in the "for each" statement, it works correctly.

The problem is the initialization of the variable vClassi:

let vClassi = peek('classi');

Thanks,

Massimiliano.

1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi,

is the field classi unique in the datamodel? If not you should modify peek by peek('classi', -1, 'CLASSI_TABLE');

Best regards

Stefan

View solution in original post

19 Replies
Anonymous
Not applicable

i dont think so.

if  For each statement is there in table while partial reloading then it will excute

i am not sure pls let me know if any changes

massimilianoruf
Partner - Contributor III
Partner - Contributor III
Author

This is the portion of the script:

if IsPartialReload() then

drop Table CROSS_FINAL;

ENDIF

for each K in $(vClassi)

CROSS_FINAL:

add load  '$(K)' & [Classe valore] AS INCROCIO_CROSS,

      '$(K)' AS CROSS_CONSUMO,

      [Classe valore] AS CROSS_GIACENZA,

   $(K) AS VALORE

resident CROSS_TMP;

next K

//At this point, the table CROSS_FINAL doesn't exist!

Anonymous
Not applicable

Hi,

it means it is going to ignore the for each script right?

massimilianoruf
Partner - Contributor III
Partner - Contributor III
Author

Yes...

richard_pearce6
Luminary Alumni
Luminary Alumni

Hi,

The add command during a partial reload behaves very much like a concatenate. If the table doesn't exisit then there's nothing to add the new data too.. therefore its skipped.

Richard

QlikCentral.com

massimilianoruf
Partner - Contributor III
Partner - Contributor III
Author

Hi Richard,

thanks for the reply but the add command now works fine (also the table was empty).

The problem is the initialization of the variable vClassi:

let vClassi = peek('classi');

Any suggestions?

Thanks in advance,

Massimiliano.

richard_pearce6
Luminary Alumni
Luminary Alumni

Good to hear Massimiliano, when I read your text it said the table didn't exist which threw me.

First question would be what was the last table loaded and was the field classi in there?

As you're not defining the table name and row number in the peek statement (which would probably be better practice) the last table is assumed (and the last record of the table).

Have you confirmed what the value is in the data to ensure its not a null or some other value?

Rcihard

massimilianoruf
Partner - Contributor III
Partner - Contributor III
Author

Richard,

this is the portion of code:

CLASSI_TABLE:

replace

load concat (chr(39) & [Classe valore] & chr(39),',') AS classi

resident CROSS_TMP;

let vClassi = peek('classi');

This code works perfectly in full Reloa, but when I try the Partial Reload it doesn't work (the variable is empty after partial reload).

Massimiliano.

richard_pearce6
Luminary Alumni
Luminary Alumni

Hi,

I've tested the code and it works fine for both partial and full reloads.

The only question would be the data table it's self. I see its from a resident load. Does that table exist? and have you checked the last record in the table, does it have a value?

Richard