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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
vignesh_s
Creator
Creator

variables

hi  all,

step 1:

i have a date excel file which as dates in  it and i loaded it

ex:

Date:

12-jan-2018

13-jan-2018

step 2:

now i want set variable to store the above date

Step 3:

i want to load the file

ex:

load *

from [..//xyz_12jan2018.xsl]

but instead of file name 12jan2018.xsl i wanna use variable set on step 2, how can i achive that,it used happen dynamically

11 Replies
shiveshsingh
Master
Master

Can you share sample data?

As i see, file name is date and u want to extract date from File name and then what?

Anil_Babu_Samineni

Perhaps something like below?

Sample:

LOAD * Inline [

Date

12-jan-2018

13-jan-2018

];

LET Variable = Peek('Date',0,'Sample');

LOAD Date1

FROM

Files.xlsx

(ooxml, embedded labels, table is '$(Variable)');


Instead third step your needed is this


ex:

load *

from [..//xyz_'$(Variable)'.xsl]

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vignesh_s
Creator
Creator
Author

in step 1 i have loaded a Date file which contains Date field

and i want to set a variable(say the varible is 'v') to store the Date field

later i have one more file to load wich is loaded from [../xyz_2jan2018] but i want to load like [../xyz_$(v)]

shiveshsingh
Master
Master

Date:
 
load Date_New from Sample.xls
order by Date asc;

Let vDate = Peek('Date_New',0,'Date');

Final:
load * from [../xyz_$(vDate)];

vignesh_s
Creator
Creator
Author

thanks for the reply anil,but u used Peek('Date',0,'Sample'); what if i have lots of date in it

Anil_Babu_Samineni

May be Loops using Peek() can deserve, But still not sure what your question ending up?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vignesh_s
Creator
Creator
Author

hi thanks for replay,the date formate in date field is 12-jan-2018 and in file name its like 12jan2018

is that fine if i use without converting date formate

vignesh_s
Creator
Creator
Author

refer shivesh singh replay my expectation is similar to that

Anil_Babu_Samineni

I have not seen any difference from him and mine

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful