Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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');