Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

vchuprina
New Contributor II

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');

4 Replies
danieloberbilli
Valued Contributor II

Re: How load data in variable?

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
New Contributor II

Re: How load data in variable?

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

danieloberbilli
Valued Contributor II

Re: How load data in variable?

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

Not applicable

Re: How load data in variable?

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" ?

Community Browser