Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vchuprina
Specialist
Specialist

How load data in variable?

I receive 2 type of files I want to determine file type

First type (1 column - Department, 2 - Customer)

Second type (1 column - Customer).

I try do this by following code:

LOAD

A AS SOURCE_TYPE

FROM [$(vFile)] 

(ooxml, no labels, header is 9 lines)

WHERE recno() = 1

;

LET ColumnName = peek('SOURCE_TYPE', 0, 'Type');

LET FileType = WildMatch('$ColumnName','Department','Customer');

But I load data only to SOURCE_TYPE and wildmatch function doesn't return value.

Also I tried use this code, but had the same result

Temp:

LOAD

     A AS Type

FROM

[$(vFile)]

(ooxml, no labels);

T1:

NoConcatenate

LOAD concat(Type,'|') as TypeList Resident Temp;

DROP Table Temp;

LET vDep1 = Match (peek('TypeList'), 'Department','Customer');

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
4 Replies
danieloberbilli
Specialist II
Specialist II

First of all I think you need to have brackets around ColumnName:

LET FileType = WildMatch('$(ColumnName)','Department','Customer');

and second: the field SOURCE_TYPE has the value or string 'A' -as you defined it in the script...so there wont be any match if you are searching for strings like 'Department' or 'Customer'

vchuprina
Specialist
Specialist
Author

A is column name.

I load data from column A from 1 line and for first type this data eq 'Department' and for second 'Customer'.

I can't understood, why this data doesn't load in ColumnName variable

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
danieloberbilli
Specialist II
Specialist II

seems to be something with your excel file. If I try it with an inline file it seems to work fine:

Not applicable

LOAD

A AS SOURCE_TYPE

FROM [$(vFile)]

(ooxml, no labels, header is 9 lines)

WHERE recno() = 1

;

LET ColumnName = peek('SOURCE_TYPE', 0, 'Type');

LET FileType = WildMatch('$ColumnName','Department','Customer');

What is the frame of your "vFile" source ? Does-it fit with "no labels" ?