Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
riho92qv
Contributor III
Contributor III

Attach and Detach for report

Hi,

I created a report with multiple objects and different objects need different selections. I used attach and detach for this and it works, Because i have  12 objects in my reports, i tried to write  a macro for this. For one object this macro is like:

Sub CH53 ' WH650 table

  ActiveDocument.ClearAll True

  ActiveDocument.GetSheetObject("CH53").Attach

  ActiveDocument.Fields("WarehouseCode").Select "650"

  ActiveDocument.GetSheetObject("CH53").Detach

End Sub

For some objects its works but not for all.

Another possible solution to my problem would be to prohibit removing detach from objects if i will reload data.

Riho

3 Replies
ravindraa
Creator
Creator

Hi Riho Michalski,

  can you explain brefly i am unable understand what do you want.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Why not work with a set of targeted bookmarks? Easier to manage, IMHO.

riho92qv
Contributor III
Contributor III
Author

Hi,

Sorry for my poor English skills, but I will try to explain more.

As I understand it is not possible to prevent the removing detach status, if I will reload data.

  1. 1. I have 12 different objects (tables, diagrams etc.) created for QV Report.
  2. 2. I have to set different selections for those objects (Warehouse code, part group etc.).
  3. 3. After setting selections on one object I will put detach status to this object.
  4. 4. I will repeated this for each object.
  5. 5. After this I get correct report.

  1. 6. I wrote a macro for this

Sub CH51
ActiveDocument.GetSheetObject("CH51").Attach
ActiveDocument.ClearAll True
ActiveDocument.Fields("WarehouseCode").Select "600"
ActiveDocument.GetSheetObject("CH51").Detach

ActiveDocument.GetSheetObject("CH52").Attach
ActiveDocument.ClearAll True
ActiveDocument.Fields("WarehouseCode").Select "600"
ActiveDocument.GetSheetObject("CH52").Detach

ActiveDocument.GetSheetObject("CH53").Attach

ActiveDocument.ClearAll True
ActiveDocument.Fields("WarehouseCode").Select "650"
ActiveDocument.GetSheetObject("CH53").Detach

’etc.

End Sub

7. This macro is not working correctly

Riho