Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to show selections in a graph saved out as PNG by macro

I have a macro that applies a bookmark and saves the png of a graph to disk. Works great. However I want to show the word "ReActive" if a certain table has one field selection and the word "ProActive if the table has more than 1 selection.

so I add this calculation to the "Text in Chart"  in the graph  =IF(GetSelectedCount(ALERT_CODE)=1, 'ReActive', ProActive')

So this works correctly when I manually select the field(s), and displays the correct word.

However when the macro runs, which applies 2 bookmarks that selects one field (saves the graph) and then more than one field (again saves the graph) in ALERT_CODE , the word does not change as when done manually. The graph always has "ProActive" even when it is displaying the correct data for one field seleted and more than one field selected in ALERT_CODE.

Does any know how I might correct this or have a different workaround.

Thanks in advance.

Jim

5 Replies
jonathandienst

Jim

I wonder if the problem is that the text in chart expression is evaluated before the macro runs, and not while it is running.

If that is the case, then I suggest that if possible, the macro be split into two, one for reactive, and one for proactive.

Hope that helps

Jonathan

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

Thanks Jonathon, good idea but no go.  Made 2 seperate macros but same result. So it appears that whatever is selected before the macro is run stand as far as this calculation is concerened.

Funny thing is I have 2 other text calculations based on the bookmark selections and they calcualte fine.

Not applicable
Author

Actually I lied. Just tested it and no matter what is selected before hand, it always shows" ProActive".

jonathandienst

Jim

Then it looks like the GetSelectedCount(ALERT_CODE) might not be working for some reason. Try just using the  GetSelectedCount(ALERT_CODE) as the text in chart to see what it is evaluating to in the export.

Do you get ReActive when viewing the object normally? Otherwise the export to image is happening without the selections. Have you checked that the selection logic is working?

Does it always export ProActive even if you make the selection(s) from ReActive before running the macro? Does it still say ReActive after the macro is complete?

If these ideas don't help, then I suggest that you post a model with some data and the macro that shows that behaviour.

Jonathan

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

Jonathon its works correctly when I apply the bookmarks manually.  The the graph that is written out by macro  is correct for the bookmark selected - meaning the booknark is working and selecting the correct fields, BUT the getselected statement is NOT applied to the graph before its written out by macro.