Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
vignesh_s
Contributor

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

Tags (1)
11 Replies
shiveshsingh
Honored Contributor

Re: variables

Can you share sample data?

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

Re: variables

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]

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
vignesh_s
Contributor

Re: variables

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
Honored Contributor

Re: variables

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
Contributor

Re: variables

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

Re: variables

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
vignesh_s
Contributor

Re: variables

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
Contributor

Re: variables

refer shivesh singh replay my expectation is similar to that

Re: variables

I have not seen any difference from him and mine

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)