Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Peek - Reading through table twice does not work

Hello, I have the issue, that reading through a table twice with "peek" doesn´t work with below code.

Mappings:

LOAD DestinationField,

     [SourceFieldFileType_1],

     [SourceFieldFileType_2]    

FROM

[Data\Mapping.xlsx]

(ooxml, embedded labels, table is FieldMapping);

for y = 1 to 2

     let vSourceColumnName = 'SourceFieldFileType_' & y

     for x=0 to 73     // Set all "from-Fields" Typ y

          let vmapfrom_$(x) = peek(vSourceColumnName,x,Mappings);

     next x;

next y;

In first loop everthing is fine - contents of column1 of 74 records read.

In second loop - trying ti read contents of column2 of the same 74 records - I get NULL as result.

It is similar to (16.11.2011 jacq) (Peek funtion is not working...), but unfortunately that solution doesn´t help me.

Would be great, if someone has an idea.

Thanks, Klaus

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Klaus

Mappings should be in quotes in the peek statement

     peek(vSourceColumnName, x, 'Mappings');

That might resolve the second pass through the table correctly.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Klaus

Mappings should be in quotes in the peek statement

     peek(vSourceColumnName, x, 'Mappings');

That might resolve the second pass through the table correctly.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Great - yes - thanks - it works -

Looks like QV´s support - letting it work in first time, although it´s a not set variable, while it just should be a fixed Value - confuses a QV beginner like me.

jonathandienst
Partner - Champion III
Partner - Champion III

I agree - things could be a little more consistent...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein