Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
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
jonathandienst

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

View solution in original post

3 Replies
jonathandienst

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

View solution in original post

alexandros17

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

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!