Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
g23
Contributor III
Contributor III

Load Max Date

Hello everyone,

I need to write a script that only loads max date data from an Athena ODBC Connection.

I have 2 dates:

g23_0-1591603325255.png

and I have writen the following script but the trace command shows an empty string:

Sub LAST_LOAD;

LIB CONNECT TO 'athena_odbc_test';

max:
LOAD Date(Floor(Max(data_esecuzione)), 'DD-MM-YYYY') as MaxDate;
SQL SELECT "data_esecuzione"
FROM AwsDataCatalog."table";

let max_date= PEEK(MaxDate,1,'max');

DROP TABLE max;
trace $(max_date);

END SUB;

Can someone please help me understand why the Trace function doesn't return any value? Thanks

1 Reply
Miguel_Angel_Baeyens

TRACE will print whatever the variable contains, if TRACE doesn't print anything, it means the variable evaluates to null.

What is the result of Max(data_esecuzione) if you only load that in the SQL part?

LOAD *
SQL SELECT data_esecuzione
FROM Table;

DBMs vary on how to deal with timestamps, if the value is not numeric, or not the value Qlik could expect, the Date() function will return a wrong value or it will be unable to interpret if it's a string value.

That will give you a hint on how to deal with the value on the Qlik side (the LOAD statement).