Skip to main content
Announcements
Do More with Qlik - Qlik Cloud Analytics Recap and Getting Started, June 19: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculations in macros

Hi

In a macro I want to assign the sum of selected field values to a variable - eg sum(Amount). Is this possible? What is the syntax that I should use?

Can I do the calculation directly in the macro or can I get the value from a chart that I have in my application?

Where is the best place to find some documentation about this - I have looked at the API Guide but did not find the solution.

Thanks, Kevin Long

2 Replies
Anonymous
Not applicable
Author

Hi Kevin,

You can use "Evaluate":

msgbox(ActiveDocument.Evaluate("Sum(Sales)"))

Not applicable
Author

Thanks Johannes

This works ok but out of interest is there a way of getting the values from a chart? Let's say that I have a chart that has calculations for period to date actual and budget sales along with number of working days etc. In my macro I run some selections to filter the table to show a single record for a sales person. Can I get the values from each of the chart expressions using something like GetSheetObject?

Thanks, Kevin