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

load sql select where part not functioning

The following script is not working like it should be.

I tried to change my loading to incremental loading.

But the moment my script should only load the ID's bigger than my variable it goes wrong.

He loads everything instead of only the ID's that are bigger.

And my variable is correctly filled.

I have the feeling he does not recognize my field : Work_Log_ID

Can anybody help me pls

here the script


 

WORKLOG:

LOAD
max(num(Right("Work_Log_ID",12))) as Work_Log_ID
From (qvd)
group by "Work_Log_ID";
// LET vMaxWorklogID = peek("Work_Log_ID", 0, WORKLOG);
let vMaxWorklogID
=

FieldValue('Work_Log_ID',1);

// SET vMaxWorklogDate = timestamp(now());
// LET vWorklogQvdCreateDate = QvdCreateTime('C:\Users\m999kbr\Desktop\Worklog.qvd');
// LET vWorklogUpdateDate = num(timestamp('$(vWorklogQvdCreateDate)'));
// set vWorklogChangeDate = $(vWorklogUpdateDate);

DROP

Table WORKLOG;

WORKLOG:

LOAD

"Assign_WorkLog_Flag",

Description as WorklogDescription,

"Detailed_Description",

"Incident_Number" as CaseID,

num(Right("Work_Log_ID",12)) as Work_Log_ID,

"Work_Log_Submit_Date",

"Work_Log_Submitter",

"Work_Log_Type";

SQL

SELECT

"Assign_WorkLog_Flag",

Description,

"Detailed_Description",

"Incident_Number",

"Work_Log_ID",

"Work_Log_Submit_Date",

"Work_Log_Submitter",

"Work_Log_Type"

FROM "HPD_WorkLog"

Where (Work_Log_ID > '$(vMaxWorklogID)');

// UNQUALIFY *;
// WORKLOG:
// Concatenate LOAD *
// From (qvd)
// where not Exists('Work_Log_ID');
// STORE WORKLOG into Worklog.qvd(qvd);

21 Replies
Anonymous
Not applicable
Author

Hello,

I have a problem equal, i used a function CAST(ListPrice AS int)

where CAST(Work_Log_ID AS int) > $(vMaxWorklogID)

Not applicable
Author

Hi Keon, I suspected your Where condition is wrong because in the Variable you are have no value. But in the Where Work_Log_ID must have Alphanumeric value like WLD0000123456 and you need to convert the field value into num to compare . So we got the wrong vaule. If your DB is oracle please use below Where cond:

Where SUBSTR(Work_Log_ID,-12,12) > $(vMaxWorklogID)