Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Jason_Michaelides
Partner - Master II
Partner - Master II

Dynamically select fields for load

Hi all,

Can anyone help me with some load script that loads a list of required fields from a spreadsheet and then only load these fields from a QVD that will have many more fields in it?

Cheers,

Jason

1 Solution

Accepted Solutions
Not applicable

Try this:

Temp:

LOAD

    concat(FieldsToLoad, '],[') AS FieldsToLoad

FROM myexcel.xlsx

(ooxml, embedded labels, table is Sheet1) ;

LET vFieldList = '[' & peek('FieldsToLoad') & ']';

Data:

LOAD

    $(vFieldList)

FROM myqvd.qvd (qvd);

DROP TABLE Temp;

View solution in original post

6 Replies
john_duffy
Partner - Creator III
Partner - Creator III

Hi Jason.

You may be able to accomplish this using the FieldName function.  See the attached application.

Let me know if this helps.

John.

Not applicable

Try this:

Temp:

LOAD

    concat(FieldsToLoad, '],[') AS FieldsToLoad

FROM myexcel.xlsx

(ooxml, embedded labels, table is Sheet1) ;

LET vFieldList = '[' & peek('FieldsToLoad') & ']';

Data:

LOAD

    $(vFieldList)

FROM myqvd.qvd (qvd);

DROP TABLE Temp;

Jason_Michaelides
Partner - Master II
Partner - Master II
Author

Hi Matt,

That looks pretty logical! I'll try it when I'm next at my PC and let you know. Looks like it'll work though.

Cheers,

Jason

Jason_Michaelides
Partner - Master II
Partner - Master II
Author

Thanks John but as far as I can see your solution will still require a change in the script to change which fields from the QVD were to be loaded.

Jason

Jason_Michaelides
Partner - Master II
Partner - Master II
Author

Matt - works like a charm.  Thanks loads mate. I just added a WHERE [Load?]='Y' clause to the temp table load and now the administrators can define which fields they want in the data model!

Jason

Message was edited by: Jason Michaelides (expanded).

Not applicable

Glad it worked!