Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasmahajan

store variable values

Hi all ,

I have field like [NonPrdBkp.Monthly Charges]  which i stored into variable vInititiavtiveCharges

Now I want to use this variable for following set analysis

vInitiviativeChargesTotal   = num(Sum({<[$(vInititiavtiveUpdateStatus)] = {'Review'}>} [$(vInititiavtiveCharges)]),'$#,##0')

I am getting error  for this ..

Any body please give suggessions.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
1 Solution

Accepted Solutions
sunny_talwar

This sample seems to work.

Script:

Table:

LOAD * Inline [

ABC

1

2

3

4

5

];

Text Box Expression - > =Sum({<$(vVar) = {1, 2, 3}>}$(vVar))


Capture.PNG

View solution in original post

9 Replies
sunny_talwar

So you have this -> vInititiavtiveCharges = [NonPrdBkp.Monthly Charges] ?

May be try it without the square brackets

vInitiviativeChargesTotal   = num(Sum({<[$(vInititiavtiveUpdateStatus)] = {'Review'}>} $(vInititiavtiveCharges)),'$#,##0')

Anonymous
Not applicable

why you required vInititiavtiveCharges and vInititiavtiveUpdateStatus?

Simply try with your field name only..

Total   = num(Sum({<FieldName= {'Review'}>} FieldName1),'$#,##0')

jonathandienst
Partner - Champion III
Partner - Champion III

Its kinda hard to debug your variables and expression without knowing how the variables are defined...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
vikasmahajan
Author

i am getting error for this set  [$(vInititiavtiveUpdateStatus)] = {'Review'}

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
sunny_talwar

Again I don't think you should use square brackets around your variable. Try without it.

Note: Expression Editor may still show your red line underneath, but the expression might still work because your variable contains a single field name. I have never tried it, but I have a feeling it should work.

vikasmahajan
Author

after removing square brackets also it is not working ?

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
sunny_talwar

This sample seems to work.

Script:

Table:

LOAD * Inline [

ABC

1

2

3

4

5

];

Text Box Expression - > =Sum({<$(vVar) = {1, 2, 3}>}$(vVar))


Capture.PNG

gsbeaton
Luminary Alumni
Luminary Alumni

Hi Vikas,

What you are doing should, in principle, work, but you need to check your variable is parsing out to a field name, rather than the contents of the field.

You should double check what your variable $(vInititiavtiveUpdateStatus) actually contains.  Try putting the variable into a text box.  Does it parse out to exactly your field name [NonPrdBkp.Monthly Charges]?  What I suspect you will get in your text box is a - (dash).  Try then putting =concat($(vInititiavtiveUpdateStatus),',' ) into the text box.  Do you see the entire contents of field?  If so, then you need to go back to your logic and make sure you are storing the field name in your variable, rather than the contents of your field.

I hope that helps.

George

vikasmahajan
Author

Thanks all for Reply...

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.