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: 
paulm
Contributor III
Contributor III

Loop through table values to input into a procedure

Hi,

I am trying to do a bit of repetitive work through a procedure.  The procedure itself works fine, but when trying to feed in values I am getting null values.  Below is the code, pretty sure its a simple mistake, so any help would be great.

LIST:

LOAD * INLINE [

    Table Name, Search Value, First Wild, Second Wild, Tag

    MONTHLY_LEU, PSO, *, *, PSO

    MONTHLY_LEU, Imperfections Charge¬, *, *, IMPERFECTIONS

    MONTHLY_LEU, Total Units, , *, POPULAR

    MONTHLY_LEU, Moyle Interconnector Charge, *, *, MOYLE

    MONTHLY_LEU, Availability Charge, *, *, AVAIL

    MONTHLY_LEU, CCL¬, *, *, CCL

    MONTHLY_LEU, SCC¬, *, *, SCC

    MONTHLY_LEU, Monthly Charge¬, *, *, MARKET_OP_CHARGE

    MONTHLY_LEU, Market Operator Charge¬, *, *, MARKET_OP_CHARGE

];

Let RCount=NoOfRows('LIST'); 

For i=0 to $(RCount) -1 

call RateAndConsumption( peek([Table Name],$(i)),peek([First Wild],$(i)),peek([Second Wild],$(i)),peek(Tag,$(i)))

Next i;

Thanks

Paul

1 Solution

Accepted Solutions
brindlogcool
Creator III
Creator III

Hi Paul,

Are you trying to use Peek within Peek.

I tried the code


let x =  peek('Table_Name',$(i), 'LIST');

It works fine

View solution in original post

4 Replies
marcus_sommer

Outside from a load-statement peek() needed a table-name and field- and table-names should be in quotes:

peek(peek('Table Name',$(i), 'List')

- Marcus

paulm
Contributor III
Contributor III
Author

Hi Marcus,

Thanks for the reply.  Still struggling with this.  I have changed it to input into a variable and still getting null.  I assume I am doing something stupid?

Let RCount=NoOfRows('LIST');

For i=0 to $(RCount) -1

let x =  peek(peek('Table Name',$(i), 'LIST'));

Next i;

Paul

brindlogcool
Creator III
Creator III

Hi Paul,

Are you trying to use Peek within Peek.

I tried the code


let x =  peek('Table_Name',$(i), 'LIST');

It works fine

paulm
Contributor III
Contributor III
Author

HI,

Took out the double peal and that resolved it.  Cheers for your help Markus.

Paul