Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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

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

3 Replies
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

rwunderlich
Not applicable

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

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.