Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

Return of MaxString() doesn't show

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;


2 Replies
Not applicable

Return of MaxString() doesn't show

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

Return of MaxString() doesn't show

Hi,

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