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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Only load csv files with specific field names

I have a number of .csv files which follow the same naming convention, but have different fields.

The format/fields I require are:

- SERIAL NUMBER

- VERSION

- DATE

- RADIO ID

Example of other files with same naming convention, but different fields:

- SERIAL NUMBER

- COST

- CLASS

- OTHER ID

Is there a way to load only those files with the required fields?

3 Replies
m_woolf
Master II
Master II

One possibility would be to set errormode = 0 before the load. The files without the correct fields would cause errors, but would be ignored.

antoniotiman
Master III
Master III

May be like this

Table:

LOAD * From YOURTABLE .....;

LET A = FieldNumber('SERIAL NUMBER','Table')+FieldNumber('COST','Table')+FieldNumber('CLASS','Table')+FieldNumber('OTHER ID','Table');

If A <> 10 then

Drop Table Table;

Exit Script;

Endif;

..............

jftalmeida
Partner - Contributor III
Partner - Contributor III

When adding a spreadsheet, use the Labels option equal to None, position it on the line where it starts:

For example:

TableSpreadsheet:

LOAD A as [Serial Number],

    B as [Cost],

    C as [Class],

    D as [Other ID]

FROM

<Path of your Worksheet>

(ooxml, no labels, header is <Place on which line begins> lines, table is <Your Sheet>);

If you rename the labels you will have no problem loading, understand?