Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
hemanthaanichet
Creator III
Creator III

How can i achieve the chart expression in script editor itself?

Hi People,

can any one have the idea about achieve an chart expression in script editor itself?

below is the expression which i would like to get in the script itself.

(sum({<VersDesc = {'Adjust','Actual'},SalTypKey={'1'},SalPer = {1},Year=p(Year),Month={'*'},
Cal_Mon={'<=$(=max(Cal_Mon))'},CPTeaFlag={'CP','RPL','ORG'},DayNumInMon = {'<=$(=max(DayNumInMon))'},DayofWeek=,RegDesc={'*'},ACode=>}SalVal))/1000
)
/
count({<Month={'*'},Cal_Mon = {"<=$(=max(Cal_Mon))"},RegDesc={'*'},ACode=>}DISTINCT (FName))
/
count({<Month={'*'},Cal_Mon = {"<=$(=max(Cal_Mon))"},RegDesc={'*'},ACode=>}DISTINCT (Month))),'#,##0')


Can  you guys  help me  how can i achieve this.... ??


Regards

Hemanth



12 Replies
Kushal_Chawda

Is there any specific reason to do it in script?

hemanthaanichet
Creator III
Creator III
Author

yeah there is reason the values are constant when i get into the chart and it wont change whenever a slection is done...

Kushal_Chawda

I did not understand "the values are constant when i get into the chart"


"and it wont change whenever a slection is done" -> Your data model is associative so, whatever selection you do, chart will reflect the values based on selection

gsbeaton
Luminary Alumni
Luminary Alumni

Not entirely sure what you are trying to achieve - is it just a case of maintaining the expression in the script?  If so, then just create the expression as a variable, then call it from your expression dialogue box:

SET myExpression = sum({<country=>}Transactions);

Expression: $(myExpression)

Is this what you mean?

hemanthaanichet
Creator III
Creator III
Author

Exactly the data model is associative, whatever the selection i do the chart will reflection the values based on selection.

But my point of view is that the values should be constant whatever the selection i do. so that if i get this calculation in the script editor itself then the values are constant whatever the selection i made in the dashboard

hemanthaanichet
Creator III
Creator III
Author

can u give me a example....?? . so that i can understand in clear

techvarun
Specialist II
Specialist II

If you want to keep a static/Constant  table then I suggest ValueList.

What is ValueList?

gsbeaton
Luminary Alumni
Luminary Alumni

Sure, in your script, just add this:


SET myExpression = sum({<country=>}Transactions);


Then in the expression window of your object:

1.png

You can then go one step further and create all of your expressions as variables and maintain them in an external CSV or Excel.  Here's a link to some script I wrote to show you how to then process all that into variables: A QlikView and QlikSense script to generate variables from a CSV include. · GitHub

best regards

George

hemanthaanichet
Creator III
Creator III
Author

its not working george.. actually my aim of doing this for my role base security.

for example the above expression will give a value as 500 for whole india (Banglore, delhi, chennai, mumbai, hyderabad).

when i give role base security it splits according to the role base security like banglore =100, delhi =100, chennai =100, mumbai= 100 , hyderabad=100.

But what i would like to show is whatever my role based security still my expression has to show 500 but not 100