Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
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

Labels (1)
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