Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

anithalux6
New Contributor III

Calendar Object

I have a calendar table created in my edit script that generates dates from today() to 3 years prior.

LET vToday =Today()

LET Start = num(makedate(Year(addyears(today(),-3)),1,1)); 

LET End = vToday;

LET NumOfDays = End - Start + 1;

Date_src:

LOAD

$(Start) + Rowno() -1 as DateID

AUTOGENERATE $(NumOfDays);

I need to change the calendar to show only dates between auditdb.LastmodifiedDate and prior 3 years.

changing vToday variable to auditdb.LastmodifiedDate is throwing an error.

LET vToday =num(makedate(Year(AuditDB.LastProcessedDate),Month(AuditDB.LastProcessedDate),Day(AuditDB.LastProcessedDate)));


What could be wrong? The AuditDB.LastProcessedDate is in the datamodel.

1 Solution

Accepted Solutions

Re: Calendar Object

The AuditDB.LastProcessedDate is in the datamodel.

But in which tables? And in which row? How should Qlik Sense know which table it should look in and which record it should get the value from? The same field can exist in many tables and a field in one table can have many values.

That's why you have to be explicit and use the peek function to get the value you want from the table:

LET vMyDate = peek('[AuditDB.LastProcessedDate]', 83949, 'MyAuditTable');

Replace MyAudit table with the name of the table from which the field value should be retrieved and replace 83949 with the row number in that table that contains the value. When using peek 0 means the first row and -1 means the last row.


talk is cheap, supply exceeds demand
2 Replies

Re: Calendar Object

The AuditDB.LastProcessedDate is in the datamodel.

But in which tables? And in which row? How should Qlik Sense know which table it should look in and which record it should get the value from? The same field can exist in many tables and a field in one table can have many values.

That's why you have to be explicit and use the peek function to get the value you want from the table:

LET vMyDate = peek('[AuditDB.LastProcessedDate]', 83949, 'MyAuditTable');

Replace MyAudit table with the name of the table from which the field value should be retrieved and replace 83949 with the row number in that table that contains the value. When using peek 0 means the first row and -1 means the last row.


talk is cheap, supply exceeds demand
anithalux6
New Contributor III

Re: Calendar Object

Thank you .. This helped me with the solution.

Community Browser