Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Get max date from the script?

I need to pick the max(saleDate ) from the script, not from the the frontend variable using max(salesdate) because then it becomes dynamic .

It should not change, it should should only after reload, other remain static.

My calender has more than 100 million records.

I want to get the max date without compromising the performance of my dashboard.

Tags (1)
1 Solution

Accepted Solutions
swarup_malli
Valued Contributor

Re: Get max date from the script?

Try creating a temp table in the script ,get the max date then drop it


/**Creating a temp table to get max date**/

ALL_SALEDATE:
Load FieldValue('DateField',IterNo()) as DateField_Max_Date_Time
AutoGenerate(1)
While not Isnull(FieldValue('DateField',IterNo()));

MAX_SDATE:
Load Max(DateField_Max_Date_Time) as Your_Max_Date

resident ALL_SALEDATE:;
Drop table ALL_SALEDATE; //no longer needed
exit script;

4 Replies
Employee
Employee

Re: Get max date from the script?

LOAD

     max(saleDate )

FROM yourqvd.qvd(qvd)

swarup_malli
Valued Contributor

Re: Get max date from the script?

Try creating a temp table in the script ,get the max date then drop it


/**Creating a temp table to get max date**/

ALL_SALEDATE:
Load FieldValue('DateField',IterNo()) as DateField_Max_Date_Time
AutoGenerate(1)
While not Isnull(FieldValue('DateField',IterNo()));

MAX_SDATE:
Load Max(DateField_Max_Date_Time) as Your_Max_Date

resident ALL_SALEDATE:;
Drop table ALL_SALEDATE; //no longer needed
exit script;

Not applicable

Re: Get max date from the script?

Hi, Create a table that stores Max date and then use the Peek function to convert field into variable.

MVP
MVP

Re: Get max date from the script?

YourTable:

load date(makedate(2015) + floor(rand()*1000)) as SaleDate AutoGenerate 100;

MaxTable: load max(SaleDate) as MaxSaleDate Resident YourTable;

LET vMaxSaleDate = date(Peek('MaxSaleDate'));

drop table MaxTable;

Community Browser