Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
eduardo_dimperio
Specialist II
Specialist II

Working with variables

Hey people,

I need some help, i think will be a silly question cause its very simple to workaround, but i want to learn so i have this 2 codes:

LET vDataCarga_ini=date(today(), 'YYYYMM');

LOAD

*

FROM

[lib://MI_csv/CONSUMO_ELEVADO_DIARIO_$(vDataCarga_ini).qvd](qvd)

WHERE $(vDataCarga_ini)??>(TODAY()-5);

************

CONCAT_TABLE:

LOAD

*

FROM [lib://MI_csv/RS_INDIVIDUAL_READ_*.qvd]

(qvd) where DATE_READ>TODAY()-2;

If i chance code two to

FROM [lib://MI_csv/RS_INDIVIDUAL_READ_??.qvd]

It works fine

So, why i can't do this in code one?

[lib://MI_csv/CONSUMO_ELEVADO_DIARIO_$(vDataCarga_ini)??.qvd](qvd)

1 Solution

Accepted Solutions
sunny_talwar

This should work, I think

[lib://MI_csv/RS_INDIVIDUAL_READ_$(vDataCarga_ini)??.qvd](qvd)

View solution in original post

10 Replies
sunny_talwar

How does the qvd filename look like? Can you share one of the names?

eduardo_dimperio
Specialist II
Specialist II
Author

Off Course

I make a qvd daily, so i have:

RS_INDIVIDUAL_READ_20170101.qvd

RS_INDIVIDUAL_READ_20170102.qvd

RS_INDIVIDUAL_READ_20170103.qvd

RS_INDIVIDUAL_READ_20170104.qvd

RS_INDIVIDUAL_READ_20170105.qvd


and goes

sunny_talwar

These are different qvd then this

[lib://MI_csv/CONSUMO_ELEVADO_DIARIO_$(vDataCarga_ini)??.qvd](qvd)

sunny_talwar

This should work, I think

[lib://MI_csv/RS_INDIVIDUAL_READ_$(vDataCarga_ini)??.qvd](qvd)

eduardo_dimperio
Specialist II
Specialist II
Author

Humm i found the problem, your code works very good but its in WHERE clause that thing goes wrong.

First problem, i need to change WHERE $(vDataCarga_ini)??>(TODAY()-5); to WHERE $(vDataCarga_ini)&'??'>(TODAY()-5);

and second I cant use a variable to filter, cause it doesn't part of the tables, for that reason i get no data.

Thank you Sunny

sunny_talwar

May be this:

Where Date#(SubField(FileBaseName(), '_', -1), 'YYYYMMDD') > Today() - 5;

eduardo_dimperio
Specialist II
Specialist II
Author

Wow, It works too !

the only strange thing, its when i try order by, not work

LOAD

*

FROM

[lib://MI_csv/CONSUMO_ELEVADO_DIARIO_$(vDataCarga_ini)??.qvd](qvd)

Where Date#(SubField(FileBaseName(), '_', -1), 'YYYYMMDD') > Today() - 5

ORDER BY DATA_DEFEITO;

sunny_talwar

You cannot use Order by in a qvd, Excel or any other type of file load..... It only works when you do it on a Resident load

Can you use 'Order By' in a QVD Load?

sunny_talwar

Also look here:Load ‒ QlikView

Capture.PNG