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

Variables bug with Expression editor?

I defined a small number of variables based on table values in a script so that I could refer to the variable, rather than directly to the table value using an inter-record function in a chart formula. This worked fine in a small application. 

However, when I scaled it up to an app with a lot more data, but similar structure, it appears to cause problems.  In particular, the expression editor shows "Expression OK", but the expression produces null values.  Furthermore, if you type random stuff at the end of the expression, the expression editor continues to show "Expression OK", instead of "Garbage after ')'...", as one might expect it to do.

Any suggestions?

Thanks!

27 Replies
Roop
Specialist
Specialist

I think that I need more information ....

Usually there is no problem scaling up an application in this way.

I would guess that you are using a variable within set analysis and this will allow you to continue typing at the end as the code does not know the content of the variable during compilation.

I would suggest that something has happened to your variables (they either have not been specified or corrupted in some way) - Display the variable content first. That is the first place to look.

Not applicable
Author

Well, what works in the small application is:

Only({<[Tariff Name] = {$(T1)}>} [Rental per month])

So, you are right that I am using it in set analysis. I just tried typing "banana" at the end of the line and the editor doesn't pick up any problem.  I guess I had assumed that the closing curly bracket would tell it where the set expression ends, since it continues to pick up and highlight kewords and field names.

The same structure does not work in the bigger version, though.  The variable Ta1 has the correct value when I look at it in the Variable Overview.

Not applicable
Author

I also followed your advice and checked the variable content (in the small version) and

[Name] & ' ' & $(T1)

produces just the name.  My understanding is that $(variablename) should instantiate to the value of variablename. is that mistaken?

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Open the Variable Overview and check that the variable exists and the literal or expression contained in the variable. $() will expand the content of the variable - this will be literal content, an expanded expression or expression fragment, or the value of a globally calculated variable (one with a leading = in the definition).

HTH

Jonathan

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

Here is a bit of set analysis that works:

Sum({$<StatusProspect = {[Sales]}, StartYearEnd = {$(#=Only(DT_year_num))},StartMonthEnd = {$(=DT_month_name_abbreviation)}>} EstimatedSalesConverted)/1000

I think that this should help

All the best

Not applicable
Author

The Variable overview shows a correct literal value for the variable (in both small and large versions).

Not applicable
Author

Thanks, but I'm not sure how this applies to my example.  What does the $ after Sum({ do?

Roop
Specialist
Specialist

The $ will enable the system to use the list bar settings.

You should also see the Set Analysis part of the help files as it is very useful

Roop
Specialist
Specialist

Sum({$<[Tariff Name]= {$(=T1)}>} [Rental per month])


should work for you .....