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

Where Clause Unexpected Result

Hello everybody,

I am doing the following in the script:

 

Temp:

LOAD
    
MaxString(SanityChecks_Execution_Date) as Max1

Resident SanityChecks

WHERE SanityChecks_LoadOrigin='GSB-Cubes';


LET vMax1=Peek('Max1',0,'Temp');


DROP TABLE Temp;

Temp1:

LOAD
    
Maxstring(SanityChecks_Time_Month) as Max1

Resident SanityChecks

WHERE (SanityChecks_LoadOrigin = 'GSB-Cubes' and SanityChecks_Execution_Date = $(vMax1));


LET vMax2=Peek('Max1',0,'Temp1');

When I perform the first load, the query returns 1 line which is correct. But when I perform the second load, the query returns zero lines which is impossible.

It is quite strange because I use as variable a value that has been extracted from the same table where I am performing the second load.

I have tried with several different combinations but seems as if the where clause does not allow more than one field, or that it does not work as expected.

Does somebody have any idea?

Thanks in advance.

Jon

1 Solution

Accepted Solutions
MVP
MVP

Re: Where Clause Unexpected Result

Jon

I assume that SanityChecks_Execution_Date and SanityChecks_Time_Month are strings because you are using MaxString()? If they are strings, then you need to put quotes around vMax1 in the where clause:

WHERE SanityChecks_LoadOrigin = 'GSB-Cubes' and SanityChecks_Execution_Date = '$(vMax1)';

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
3 Replies
MVP
MVP

Re: Where Clause Unexpected Result

Jon

I assume that SanityChecks_Execution_Date and SanityChecks_Time_Month are strings because you are using MaxString()? If they are strings, then you need to put quotes around vMax1 in the where clause:

WHERE SanityChecks_LoadOrigin = 'GSB-Cubes' and SanityChecks_Execution_Date = '$(vMax1)';

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

Re: Where Clause Unexpected Result

1) are you sure the variable is correctly populated?

2) the field SanityChecks_Execution_Date is a complete date (hh:mm:ss) and doesn'm match

3)transform the string in date again

jhope it helps

Not applicable

Re: Where Clause Unexpected Result

Thanks for your answers.

The problem was that the value stored was an integer, and i was treating it as a string.

Everyday issues with dates ;-)

Thanks!

Community Browser