Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
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
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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
Not applicable
Author

Hi,

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

Joe

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Not applicable
Author

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.