Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dollar Sign Expansion

Hi guys,

In the load script I have :

Let Content = 'Costs'

How do I display this variable's value 'Costs' in a text object or expression.

I tried variation of the following = ${ (Content) } but nothing returns 'Costs'

Anyone know what I am doing wrong here?

Thx

Ludwig

8 Replies
Not applicable
Author

Hello ludwig, in this case you would not need the dollar sign eexpansion, you can only put

=Content

in your text object expression

Not applicable
Author

Sorry, I forgot to mention that if you want to use the dollar sign expansion (in case you have a column named Content), you can do it this way.

='$(Content)'

Regards

Not applicable
Author

Thanks for the hint...the singe quotes did it....,ahaha!

So to get a chart displaying values I thouth this would work..

=Sum( ' $(Content)' ) but it didn't . What's wrong there?

The variable Content is set to Revenue in the load script and I have a column revenue in the data.

I'd like to add a button to change the variable per user klick to change the measure shown in the chart.

What are the generall rules for these dollar sign expansision?

Thx so much

Ludwig

Not applicable
Author

Hello, if you want your variable to expand the name of a column, you can simply take out the single quotes, like this:

sum($(Content))

so if the variable was declared to contained the value 'Revenue' and Revenue is the name of a data column, the expression should work just fine.

Regards

Not applicable
Author

Great. It works.

Just a question how you go in debugging this types of issues...is there something more than try and error?

Error message are also not avialable...

Thx

Not applicable
Author

Well it is a bit complicated that I could not explain very clear, it depends on how you declare the variable (let, set, nothing) and the use of the variable. I guess you can get the right result only with experience.

Regards

johnw
Champion III
Champion III

It's like any programming language. If you understand the language, the syntax, how to assemble logical and data structures, you won't get stuck doing trial and error. You just know how to do it correctly. On the other hand, while LEARNING the language, you're probably going to go through a LOT of trial and error. If you don't want to learn by trial and error, you can also learn by doing things like carefully reading the reference manual or help text on whatever subject you're dealing with at the time. I learn by a combination of approaches myself, and both trial and error and reading are in there.

Not applicable
Author

Thanks for all the hints guys. I see where this is going with the expressions and it is as John said once the principials are clear and with a bit of trial and error it works....Thx again.