Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In Qlik Sense there is a lesser known feature named "Chart level scripting" or "Chart scripts", but there is not that much documentation available on that feature/topic.
I see the Chart level scripting | Qlik Sense on Windows Help and the Youtube video, SaaS in 60 - Chart-level Scripting.
But but besides these resources there is not much information to find.
I am interested to know what chart level scripting can (can not do), and how to use it? What's the syntax and how is it used? If you are interested in this as well, please consider supporting my ideation to improve the help pages on this topic: Ideation #485710
Do you,the community, have anything else to share on this topic? Do you know about any good sources? Or can you share something in a comments section..
@Vegar
It's not really something I have much information about, so I voted for your idea as well. It would be interesting to know more about what it covers.
When I needed something for a specific problem a while ago, I came across this video that took me down this path of creating scripts at the graphical level and gave a basic explanation that clarified the subject further.
https://www.youtube.com/watch?v=6JDJxS2RujQ
- Regards, Matheus
There were some samples and discussion here.
Honestly, it sounds better than it actually is. I wasn't able to get it to do anything very useful other than the below. Some of the things I thought it would do turned out to be incorrectly documented.
My own two scripts:
Row Numbers: // Requires a measure named Row with a starting value of 0 or null(), name can be adjusted
Let P = HCNoRows();
For J = 1 to P
Put Row(J) = J;
Next;
------
Running Total: // Requires a measure named RunningTotal with a starting value of 0 or null(), name can be adjusted. Measure name here is Sales, can also be referenced with a measure number.
Let P = HCNoRows(); // Get number of rows and set up required variable
Let vRunningTotal= 0;
For J = 1 to P
// In this example, we will add a running total by Dim1 and Dim2 but this can be adjusted to any number of dimensions with any names
Let vDim = HCValue(#hc1.dimension.1, J) & HCValue(#hc1.dimension.2, J); // Add the current row dimension values
Let vDimPrev = HCValue(#hc1.dimension.1, J-1) & HCValue(#hc1.dimension.2, J-1); // And the previous row values
// If the current row's dimensions match the previous row's, continue the running total
If vDim = vDimPrev then
Let vRunningTotal = vRunningTotal + HCValue(Sales,J);
else // If this row starts a new subtotal set, subtotal is just Sales
Let vRunningTotal = HCValue(Sales,J);
end if
// Put the calculated subtotal into the Subtotal column
Put RunningTotal(J) = vRunningTotal
Next;
// Reset the variable because that's what Qlik's samples do
Let vRunningTotal = 0;
@Or The post by you linked to by @Michael_Tarallo is the best resource yet, it had a useful zip file with some files to look at.
The Youtube video that you, @MatheusC , posted in combination with that post give me a better basic understanding of the chart Scripting.
Thanks for sharing.
@Michael_Tarallo or @Patric_Nordstrom do you have any other chart level script examples to share ?
Yes, more informations would be nicely accepted.
Thank you all for the shared material