Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On May 18th at 10AM EDT we will answer your QlikView questions live. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro to detach an object

1. Can I detach an object (chart) by condition of selection in a pivot table instead of using macro?

2. If I have to use Macro to detach an object, how do I trigger the macro to run for each (any) selection I made within the sheet object?

1 Solution

Accepted Solutions
Anil_Babu_Samineni

I never tried this

Try This with Onselect Trigger and give Actions for that.

Sub Detach

ActiveDocument.GetSheetObject("CH01").Detach

End Sub

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

6 Replies
Anil_Babu_Samineni

Why Do you require macro,

QlikView Macro's Are Bad

Qlikview, we do have option called Detach. Is there any reason to add macro?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Not applicable
Author

how do I find the option? I need the option to be activated by condition only. If that possible?

Anil_Babu_Samineni

Right click the Object and then See? If you want Macro. Experts will help you

Capture.PNG

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Not applicable
Author

I know you can do that manually. But I want it to be detached automatically when selection of field (condition) meet.

Anil_Babu_Samineni

I never tried this

Try This with Onselect Trigger and give Actions for that.

Sub Detach

ActiveDocument.GetSheetObject("CH01").Detach

End Sub

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

Not applicable
Author

I find the following from another post:

Attach/Detach an object for selecting List Box

SUB TEST
v_AgentCnt = ActiveDocument.Evaluate("=GetSelectedCount(REGION)")
If v_AgentCnt>0 Then
ActiveDocument.GetSheetObject("CH01").Detach
Else
ActiveDocument.GetSheetObject("CH01").Attach
End If
END SUB


And put it on the field you want (Document/Properties/Triggers/Field Event Triggers) on OnChange event.
(if you're using qv lower than ver 9, Document/Properties/Macros/Field Event Triggers).