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

FieldValue Doesn't Work Consistently

Has anyone encountered an issue using FieldValue()?

Example:

Load

  FieldValue('ColumnA',IterNo()) as ColumnA

AutoGenerate(1)

While not Isnull(FieldValue('ColumnA',IterNo()))

It works for some columns and not for others. It makes no sense. Some columns, it will load in all the correct values. For other columns, it will load in several instances of a questions mark. Yes, the values show up as "?".

And yet, for another column, it loads in nothing at all.

I've tired everything from renaming columns to aliasing differently and I can't find a pattern as to why this doesn't work. Super frustrating. Anyone have any solutions?

Ab.

8 Replies
anbu1984
Master III
Master III

Set NullInterpret = '';

Load * Inline [

ColumnA,ColumnB

1

2

3

4,4

5

,4

6,6];

Load

  FieldValue('ColumnA',IterNo()) as ColumnA

AutoGenerate(1)

While not Isnull(FieldValue('ColumnA',IterNo()));

Can you show full script?

marcus_sommer

Maybe you tried another while-condition with fieldvaluecount():


....

while iterno() < fieldvaluecount('ColumnA');


- Marcus

effinty2112
Master
Master

Hi Abhijeet,

I'm having a similar problem. If you got to the bottom of it please advise. Can you see what is wrong here?

I would expect this script to create a table MaxNum with one record, comprising one field MAXNUM of value 45. Instead I get a value '?'.

I am exasperated over this. any help would be gratefully received.

Kind regards

Andrew Walker

Num:

LOAD * INLINE [

    Num

    1

    45

    3

    6

    8

    3

];

MaxNum:

LOAD max(FieldValue('Num',RecNo()) ) as MAXNUM

AutoGenerate FieldValueCount('Num');

marcus_sommer

QlikView is struggling with the string-intepretation from this value and showed only a ? as placeholder. But if you forced an additionally string-intepretation per num() or dual() the correct values will be displayed. see also: Re: Problem with FieldValue

- Marcus

hic
Former Employee
Former Employee

I am not surprised. I think you use the FieldValue() function in a way that you shouldn't.

The FieldValue(fieldname,n) function returns the field value found in position n of the field. In other words: It accesses the symbol tables to get the n:th field value. But you use the function like

    FieldValue('ColumnA',IterNo()) as ColumnA

I.e. you use the function in the same Load statement that is about to define the symbol table for ColumnA (in red). Of course you can then get into a recursive definition. Or worse; the memory for the n:th position of the symbol table is perhaps already allocated, but has not yet been assigned a value.

HIC

Zaga_69
Creator
Creator

Hi Henric,

I am struggling with Fieldvalue () function in a loop:

I have an Excel table with the following data:

ReferenceTable.PNG

I create a loop to concatenate multiple QVDs and have a single table with all QVD names and fields:

Loop_Dictionary.PNG

it works perfect when I do not have equals Folder names in the Excel. However, when having the same Folder name, the LET vQVDFolder= FieldValue ('Folder' $(i)); does not saved the Folder name in the variable. 

 

Any idea why

Thanks,

 

 

marcus_sommer

Fieldvalue() isn't suitable to read data from a table unless you could ensure that your field there didn't contain redundant data and isn't a key-field. To read from the table you could use:

noofrows('TableName')

to get the number of records and:

peek('FieldName', $(iterationCounter), 'TableName')

to pick the appropriate field-value - whereby the iterationCounter starts not with 1 else with 0.

- Marcus

Zaga_69
Creator
Creator

Hi Marcus,

I realized that FieldValue() function does not work with redundant/same fields.

Ia adjustd the code I use the PEEK() function and now works,

Thanks,

Edi