Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
If you are a Qlik Insight Bot user, join this collaborative group: JOIN GROUP
Highlighted
Not applicable

Use of the FieldValue function on several lines

Hello,

I just wrote the following code:

Rows:  NoConcatenate LOAD BUKRS, GJAHR, CPUDT Resident BKPF;
DROP Table BKPF; 
FOR i=1 to $(rows)
SET BUKRS='';
SET GJAHR = '';
SET CPUDT = '';
Trace i = $(i); 
Let BUKRS = FieldValue('BUKRS',$(i)); 
Let GJAHR = FieldValue('GJAHR',$(i)); 
Let CPUDT = Date(FieldValue('CPUDT',$(i)),'YYYYMMDD');
Trace BUKRS = $(BUKRS) - GJAHR = $(GJAHR) - CPUDT = $(CPUDT);

NEXT

In my example, there are three rows in my 'Rows' table. The trace function works fine with the first record, like this:

BUKRS = 1000 - GJAHR = 2014 - CPUDT = 20141214, but for the following records, it looks like this BUKRS = 1100 - GJAHR = - CPUDT = . Only the BUKRS variable is set, even though there are values for GJAHR and CPUDT in my 'Rows' table.

I've tried to look for solutions for the last hour, but I could not find any.

Thanks!

1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Re: Use of the FieldValue function on several lines

As Joe pointed out, FieldValues() operates on values, not rows. If you want to process a table row-by-row use the peek() function.

-Rob

View solution in original post

3 Replies
Highlighted
Not applicable

Re: Use of the FieldValue function on several lines

Hi,

Fieldvalue requires distinct values on every row, what does your data look like? This may be your issue

Joe

Highlighted
MVP & Luminary
MVP & Luminary

Re: Use of the FieldValue function on several lines

As Joe pointed out, FieldValues() operates on values, not rows. If you want to process a table row-by-row use the peek() function.

-Rob

View solution in original post

Highlighted
Not applicable

Re: Use of the FieldValue function on several lines

Hi,

Right, I did not understand the bit about distinct values in the help for FieldValue(). Thanks! GJAHR and CPUDT were indeed identical for the three records in my table.

The peek() function works just fine. Thanks again.