Berstrom
Berstrom

Reputation: 5

How to load data in qlikview with loop and not existent fields?

I am trying to load data in qlikview with a for loop, where 1,2 and 3 are the fieldnames:

for a = 1 to 3
Test:
    LOAD [$(a)] 
    FROM [$(Path)\File.xlsx]
(ooxml, no labels, table is [Sheet]);

next

The problem is that I don`t know which of the fields 1,2 and 3 is actually existent in the table. So if 2 is not in the table I get the "field not existent" error. Is there a possibility that qlikview recognizes that the filed is not existent and therefore does not try to load this field?

Best regards

Upvotes: 0

Views: 89

Answers (1)

EldadT
EldadT

Reputation: 932

I would use

set errormode = 0
for a = 1 to 3
Test:
    LOAD [$(a)] 
    FROM [$(Path)\File.xlsx]
(ooxml, no labels, table is [Sheet]);

next
set errormode = 1

this way if the field is not in the table then it just ignores it and continues the loop

Upvotes: 1

Related Questions