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: 
marko_rakar
Creator
Creator

Using IF statement in load while using variable

I am trying to use IF statement in my load script and this IF statement should use variable to check if conditions are met:

let noRows = NoOfRows('Transposed')-1;

let vNo = 0;

for i = 0 to $(noRows)

       

        let Kan = peek('Kan',$(i),'Transposed');

        let Gla = peek('Gla',$(i),'Transposed');

        let ID = peek('ID',$(i),'Transposed');

       

        if( $(vNo) = '0', let Li = Peek('Kan',$(i), 'Transposed'));

       

        EnumeratedAndTransposed:

        LOAD

        '$(Kan)' as Kan,

        '$(Gla)' as Gla,

        '$(ID)' as ID,

        '$(Li)' as Li

       

        FROM RESIDENT Transponded;

if (($(no)=12), let n = 0, let n=n+1);

next i;

Problem is in my IF statement, for some reason they do not work. Idea behind this code is to enumerate rows as a member of particular group (first 12 rows are member of same group and group name is contained in first record). After 12th record I reset my counter and begin again.

When I enter the code as above, in my script editor I have red underlined comma and my statement does not work.

Any ideas?

0 Replies