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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How do I create variable using table column

Dear team

How do I create variable from

T1:
LOAD * INLINE [
CDate
01/31/2015
02/29/2015
03/31/2015
04/30/2015
05/31/2015
01/31/2015
02/29/2015
03/31/2015
04/30/2015
05/31/2015
01/31/2015
02/29/2015
03/31/2015
04/30/2015
05/31/2015
]
;

like

let vDT1 = COB_31012015.qvd;

let vDT1 = COB_28022015.qvd;

let vDT1 = COB_31032015.qvd; and like wise

Thanks for help

1 Solution

Accepted Solutions
sunny_talwar

May be this:

T1:

LOAD * INLINE [

CDate

01/31/2015

02/29/2015

03/31/2015

04/30/2015

05/31/2015

01/31/2015

02/29/2015

03/31/2015

04/30/2015

05/31/2015

01/31/2015

02/29/2015

03/31/2015

04/30/2015

05/31/2015

];

For i = 1 to 15

  LET vDT$(i) = Peek('CDate', -$(i), 'T1');

NEXT


Capture.PNG

View solution in original post

10 Replies
sunny_talwar

All are vDT1 or you forgot to increment them? vDT1, vDT2... and so on?

sunny_talwar

May be this:

T1:

LOAD * INLINE [

CDate

01/31/2015

02/29/2015

03/31/2015

04/30/2015

05/31/2015

01/31/2015

02/29/2015

03/31/2015

04/30/2015

05/31/2015

01/31/2015

02/29/2015

03/31/2015

04/30/2015

05/31/2015

];

For i = 1 to 15

  LET vDT$(i) = Peek('CDate', -$(i), 'T1');

NEXT


Capture.PNG

maxgro
MVP
MVP

or maybe you want to do something in loop on every file?

1.png

T1:

LOAD * INLINE [

CDate

01/31/2015

02/29/2015

03/31/2015

04/30/2015

05/31/2015

01/31/2015

02/29/2015

03/31/2015

04/30/2015

05/31/2015

01/31/2015

02/29/2015

03/31/2015

04/30/2015

05/31/2015

];

For i=0 to NoOfRows('T1')-1

  LET file = 'COB_' & date(date#(Peek('CDate', $(i), 'T1'), 'MM/DD/YYYY'), 'DDMMYYYY') & '.qvd';

  trace ..... elab file $(file) .....;

  // read file ? store ?

NEXT;

Anonymous
Not applicable
Author

Hi Sunny

I appreciate for answer.

Thanks

Satish

Anonymous
Not applicable
Author

Hi Maxgro

Nice solution

Thanks

Not applicable
Author

Hi Satish,

Maybe you are looking for something like this (to be added after your load inline) :

I added a load distinct as there is duplicate date.

Load Distinct CDate Resident T1;

qFilesCount:

Load

  count(CDate) as qCntDate

Resident T1;

Let qCntFiles = Peek('qCntDate',0,'qFilesCount');

FOR i=0 to $(qCntFiles)-1

     Let vDt$(i) = 'COB_' & Date(Date#(Peek('CDate',$(i),'T1'),'MM/DD/YYYY'),'MMDDYYYY') & '.qvd';

NEXT

Drop tables qFileCount;

Regards

Anonymous
Not applicable
Author

Hi Maxgro

I am getting unsorted order

I want like Jan, Feb, Mar. Here is uneven order

Thanks

maxgro
MVP
MVP

you can find my .qvw and qvd test file in the attachments; to try, put all the files in the same dir

table is sorted by filedate desc, in the input box the variable with the last (more recent) file name

1.png

Anonymous
Not applicable
Author

Hi Gilles

Still the sorting is issue, Thanks for follow up