Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

massimilianoruf
New Contributor II

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
s_kunte23
Contributor III

Re: Partial Reload and variables

Hi,

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

Best regards

Stefan

19 Replies
commonqlik
Contributor II

Re: Partial Reload and for each statement

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
New Contributor II

Re: Partial Reload and for each statement

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!

commonqlik
Contributor II

Re: Partial Reload and for each statement

Hi,

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

massimilianoruf
New Contributor II

Re: Partial Reload and for each statement

Yes...

richard_pearce6
Valued Contributor

Re: Partial Reload and for each statement

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
New Contributor II

Re: Partial Reload and variables

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
Valued Contributor

Re: Partial Reload and variables

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
New Contributor II

Re: Partial Reload and variables

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
Valued Contributor

Re: Partial Reload and variables

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

Community Browser