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

How to apply variable to get the value from table?

Hi,

I have following excel table. this table has many rows.

Temp:

AddressFile
C:\Emp Folderemp.xlsx
C:\ ID Folderid.csv

How I apply variable to get the address= C:\Emp Folder ?

I want to run loop to get the specific record in column.

3 Replies
sunny_talwar

May be use Peek or use FieldValue() functions.

Temp:

LOAD Address,

     File

FROM ...;

FOR i = 1 to FieldValueCount('Address')

     LET vAddress$(i) = FieldValue('Address', $(i));

NEXT i

Kushal_Chawda

Can you tell me what is the reason to create the variable for specific field value? You can directly use the field value in set analysis or in conditions or you can filter

sudeepkm
Specialist III
Specialist III

I'm not sure about your requirement but I remember working on an assignment to load file, path and type details of source files from a spreadsheet and then creating the tables dynamically. Something like below but I had the format of the source also available in my spreadsheet.

If any of the values in the source xlsx is wrong then it would result in reload being failed. Proper debug is required for all source file scenarios prior reloading the full script.

src:

LOAD file,

     path,

     type

FROM

[..\..\..\load.xlsx]

(ooxml, embedded labels, table is Sheet1);

let vPath = '';

let vFile = '';

let vType = '';

for counter = 1 to NoOfRows('src')

     vFile = peek('file',$(counter)-1,'src');

     vPath = peek('path',$(counter)-1,'src');

     vType= peek('type',$(counter)-1,'src')

     LOAD * From

     $(vPath)$(vFile)$(vType);

next counter