Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Return of MaxString() doesn't show

Year_Week is a field in my data and I use MaxString({$1}Year_Week) to get the latest year and week the data is updated (for example 2011-40), and shows it in a text object.
However, when I open the document, the text object is empty, but if I make any selection or just choose Clear when I open the document, the string shows in the text object. The document opens with no selections, have tried to save it with a selection and opened it again, but the same problem occurs.

If I use MaxString({$}Year_Week) og just MaxString(Year_Week), the string shows when I open the document, but then it will change to the max string for the current selection, and that is not the intention.

How can the I get the presentation in the text object correct when the document is opened?

1 Solution

Accepted Solutions
Not applicable
Author

Since the value does not change until the next reload, you should consider moving the logic to the load scripts. You can load the max of Year_Week to a temp table and then assign it to a variable. Something like this should work:

MaxYearWeekTable:

LOAD max(Year_Week) as MaxYearWeek

FROM table_contain_year_week;

LET vMaxYearWeek = peek('MaxYearWeek',-1,MaxYearWeekTable);

DROP TABLE MaxYearWeekTable;


View solution in original post

2 Replies
Not applicable
Author

Since the value does not change until the next reload, you should consider moving the logic to the load scripts. You can load the max of Year_Week to a temp table and then assign it to a variable. Something like this should work:

MaxYearWeekTable:

LOAD max(Year_Week) as MaxYearWeek

FROM table_contain_year_week;

LET vMaxYearWeek = peek('MaxYearWeek',-1,MaxYearWeekTable);

DROP TABLE MaxYearWeekTable;


Not applicable
Author

Hi,

thanks, it worked fine changing "LOAD max(Year_Week)..."  to
"LOAD MaxString(Year_Week)..."