Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
helen_pip
Creator III
Creator III

Can you execute a variable through a macro

Dear Qlikview user

Is it possible to execute a variable through a macro?  If so, could you kindly share the code?

I am trying to build my code bit by bit, and wanted to know this part first

Kind Regards

Helen

9 Replies
trdandamudi
Master II
Master II

Not clear when you say execute a variable ? Do you want to read the variable value from a macro ?

helen_pip
Creator III
Creator III
Author

Hello


Thank you for replying


1. I have a pivot table which contains a drill down group.  Each dimension in the group is a variable.  I.e. v1, v2 etc

2. I want to have a button which runs a macro and change the pivot table to display that particular dimension within the group

I have parts of the macro already I.e. This part of the macro cycles through the group.  However I want to have a button which skips parts of the cycle group and just jumps straight to particular variables within the Outpatients_View_By_Fields group

SUB setgroup

SET gp = ActiveDocument.GetGroup("Outpatients_View_By_Fields")

gp.cycle 1

END SUB

Are you able to help?

Kind Regards

Helen

Colin-Albert

Do you actually need to do this using a macro?

It is far better to use native functionality in QlikView to create the application rather than using macros.

You could have multiple charts that you show / or hide based on Actions rather than using a macros for example.

This post is worth reading  Macros are Bad

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

I want to ask you a question, Are you using Macro for any specific purpose.

If you are using Macro to just achieve something, then let us know what is it. It may happen that same thing can be achieved without Macro.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
trdandamudi
Master II
Master II

Please take a look at the below link and see if it helps...

button to switch dimensions in dimension groups

Set the active field in a cyclic group.qvw

Need help on macro to select group field value

Note: Added second and third link

helen_pip
Creator III
Creator III
Author

Hello Colin

I thought a macro would be best, because my pivot table is held within a container and we have opted for a container method to save on memory.

The container has 6 pivot tables within it and each contains the same group called Outpatients_View_By_Fields fr the dimensions.  The dimensions within this group also have headings at the top of the page


I wanted to place buttons on each heading at the top of the page, and the macro within these buttons would interact with the pivot table drill down group and change the table to show the correct dimension related to the heading

Can a macro achieve this?

Kind Regards

Helen

helen_pip
Creator III
Creator III
Author

Hello Kaushik

I thought a macro would be best, because my pivot table is held within a container and we have opted for a container method to save on memory.

The container has 6 pivot tables within it and each contains the same group called Outpatients_View_By_Fields fr the dimensions.  The dimensions within this group also have headings at the top of the page


I wanted to place buttons on each heading at the top of the page, and the macro within these buttons would interact with the pivot table drill down group and change the table to show the correct dimension related to the heading

Can a macro achieve this?

Kind Regards

Helen

Colin-Albert

A macro is rarely the best solution in QlikView.

You could use expression variables. There are many posts if yous search for expression variables, I would recommend Henric Cronstrom's hic post as a good starting point.

The Magic of Variables

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Dear Helan,

Is it possible for you to share qvw app with sample data. Also guide us with example what you are trying to achieve.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!