Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Can you use a date variable in Edit Script?

Hi

I am trying to limit the number of records that I import in Edit Script by using a date variable.

One table has one record with a date field which I want to use as the variable . The other table has the records.

Table with date record:

LOAD date,

    Module;

SQL SELECT *

FROM live where Module = 'db';

The code with the variable is below:

LOAD

    date,

    debtor,

    amt;

SQL SELECT

      date,

      debtor,

      amt

From debtor_table where date >= 'variable';

Is it possible to link the variable to a value that is retrieved in earlier script from a different table?

I notice that there are some system variable names for dates - can I use them as the variable instead?

Regards

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Can you use a date variable in Edit Script?

Yes, something like this for example. You will need to make sure that the variable gets the same date format as the date field in your second table has.

T1:

LOAD date,

    Module;

SQL SELECT *

FROM live where Module = 'db';

LET vDate = peek('date');           //pick the date value from the last record of table T1

T2:

LOAD

    date,

    debtor,

    amt;

SQL SELECT

      date,

      debtor,

      amt

From debtor_table where date >= '$(vDate)';


talk is cheap, supply exceeds demand
4 Replies
khadeer_sparks
Valued Contributor

Re: Can you use a date variable in Edit Script?

Instead of that u can change both fields as same date format(i.e 'YYYY-MM-DD') then keep as same name to both fields then give the association.

MVP & Luminary
MVP & Luminary

Re: Can you use a date variable in Edit Script?

Yes, something like this for example. You will need to make sure that the variable gets the same date format as the date field in your second table has.

T1:

LOAD date,

    Module;

SQL SELECT *

FROM live where Module = 'db';

LET vDate = peek('date');           //pick the date value from the last record of table T1

T2:

LOAD

    date,

    debtor,

    amt;

SQL SELECT

      date,

      debtor,

      amt

From debtor_table where date >= '$(vDate)';


talk is cheap, supply exceeds demand
Not applicable

Re: Can you use a date variable in Edit Script?

Hi,

Perhaps, you can try something like this:

TableWithDateRecord:

Load * Inline

[

DateField

1/4/2013

];

Let datevariable=('DateField',-1,'TableWithDateRecord');

OtherTable:

Load * Inline

[

Key,Value,Date

A,10,1/3/2012

B,20,1/2/2013

C,30,1/12/2013

D,40,1/4/2013

E,40,2/4/2013

]

;

Load *

Resident OtherTable

where Date <$(datevariable);

Regards,

-Khaled

Not applicable

Re: Can you use a date variable in Edit Script?

Thanks Gysbert

I have used coding in Access before but QV is different.

Community Browser