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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trouble with the Lookup...

This just ain't working ... I'm getting NULLs in the result.

/*

CREATE TABLE dbo.HadoopIngestionTableCounts

(TableName  VARCHAR(128) NOT NULL,

CountRecs  BIGINT NOT NULL,

DateIngestion  Datetime NOT NULL,

InsertTS    Datetime NOT NULL

);

*/

LET vTodayStr = Date(Today());

LET vYesterdayStr = Date(Today() - 1);

LastRunStatistics:

SQL SELECT CountRecs FROM dbo.HadoopIngestionTableCounts WHERE TableName IN ('customers', 'suppliers') AND DateIngestion = '$(vYesterdayStr)';

LET vNumRowsMemDemoLast = Lookup('CountRecs', 'TableName', 'customers', 'LastRunStatistics');

LET vNumRowsMembershipLast = Lookup('CountRecs', 'TableName', 'suppliers', 'LastRunStatistics');

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Hi Romi,

where is 'TableName' Field in SQL Select Statement ?

View solution in original post

3 Replies
Anil_Babu_Samineni

Variables should placed before Load / Select statement only..

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
antoniotiman
Master III
Master III

Hi Romi,

where is 'TableName' Field in SQL Select Statement ?

Not applicable
Author

Ha ... Thanks so much for pointing out the silly error. It's working all good now. Changed script is as follows...

/*

CREATE TABLE dbo.HadoopIngestionTableCounts

(TableName  VARCHAR(128) NOT NULL,

CountRecs  BIGINT NOT NULL,

DateIngestion  Datetime NOT NULL,

InsertTS    Datetime NOT NULL

);

*/

LET vTodayStr = Date(Today());

LET vYesterdayStr = Date(Today() - 1);

LastRunStatistics:

SQL SELECT TableName, CountRecs FROM dbo.HadoopIngestionTableCounts WHERE TableName IN ('customers', 'suppliers') AND DateIngestion = '$(vYesterdayStr)';

LET vNumRowsMemDemoLast = Lookup('CountRecs', 'TableName', 'customers', 'LastRunStatistics');

LET vNumRowsMembershipLast = Lookup('CountRecs', 'TableName', 'suppliers', 'LastRunStatistics');