Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
hector_munoz
Specialist
Specialist

Macro to print trigger actions

Hi guys,

First of all apologyzes if Scripting Fiorum is not the proper place to launch this question...

I need a full list of all the actions contained in all kind of triggers in a QlikView document. Triggers like activate or deactivate a sheet, on input or on change in fields or variables...

Searching in API document I have a function and a macro that shows me, for the moment at a sheet level, the type of the actions contained in its triggers 'Activate' and 'Deactivate':

FUNCTION DescripcionTipoAccion (tipo)

  SELECT CASE tipo

  CASE 0

  DescripcionTipoAccion = "Info"

  CASE 1

  DescripcionTipoAccion = "Sql"

  CASE 2

  DescripcionTipoAccion = "Lock All"

  CASE 3

  DescripcionTipoAccion = "Unlock All"

  CASE 4

  DescripcionTipoAccion = "Clear All"

  CASE 5

  DescripcionTipoAccion = "Clear All Incl Locked"

  CASE 6

  DescripcionTipoAccion = "Back"

  CASE 7

  DescripcionTipoAccion = "Forward"

  CASE 8

  DescripcionTipoAccion = "File Close"

  CASE 9

  DescripcionTipoAccion = "Next Tab"

  CASE 10

  DescripcionTipoAccion = "Prev Tab"

  CASE 11

  DescripcionTipoAccion = "Export"

  CASE 12

  DescripcionTipoAccion = "Launch"

  CASE 13

  DescripcionTipoAccion = "Macro"

  CASE 14

  DescripcionTipoAccion = "Recall Bookmark"

  CASE 15

  DescripcionTipoAccion = "Replace Bookmark"

  CASE 16

  DescripcionTipoAccion = "Create Bookmark"

  CASE 17

  DescripcionTipoAccion = "Print Report"

  CASE 18

  DescripcionTipoAccion = "Activate Sheet"

  CASE 19

  DescripcionTipoAccion = "Print Sheet"

  CASE 20

  DescripcionTipoAccion = "Print Object"

  CASE 21

  DescripcionTipoAccion = "Restore Object"

  CASE 22

  DescripcionTipoAccion = "Minimize Object"

  CASE 23

  DescripcionTipoAccion = "Maximize Object"

  CASE 24

  DescripcionTipoAccion = "Activate Object"

  CASE 25

  DescripcionTipoAccion = "Select Excluded"

  CASE 26

  DescripcionTipoAccion = "Clear Other Fields"

  CASE 27

  DescripcionTipoAccion = "Select Possible"

  CASE 28

  DescripcionTipoAccion = "Lock"

  CASE 29

  DescripcionTipoAccion = "Unlock"

  CASE 30

  DescripcionTipoAccion = "Pareto Select"

  CASE 31

  DescripcionTipoAccion = "Set Value"

  CASE 32

  DescripcionTipoAccion = "Field Select"

  CASE 33

  DescripcionTipoAccion = "Field Toggleselect"

  CASE 34

  DescripcionTipoAccion = "Open Url"

  CASE 35

  DescripcionTipoAccion = "Document Chain"

  CASE 36

  DescripcionTipoAccion = "Eov"

  CASE ELSE

  DescripcionTipoAccion = "Desconocido"

  END SELECT

END FUNCTION

SUB AccionesQV

  ' ACCIONES DE LA PESTAÑA ACTUAL

  SET hoja_actual = ActiveDocument.ActiveSheet

  SET propiedades = hoja_actual.GetProperties

  ' Al activar la pestaña

  SET acciones = propiedades.OnActivateActionItems

  mensaje = "Acciones al activar pestaña" + vbCrLf

  FOR i = 0 TO acciones.Count - 1

  mensaje = mensaje & "         # " & (i + 1) & " " & DescripcionTipoAccion(acciones.item(i).Type) & vbCrLf '": Tipo -> " & acciones.item(i).Type & ", descripción ->: " &

  NEXT

  mensaje = mensaje + vbCrLf

  ' Al abandonar la pestaña

  SET acciones = propiedades.OnDeactivateActionItems

  mensaje = mensaje + "Acciones al abandonar pestaña" + vbCrLf

  FOR i = 0 TO acciones.Count - 1

  mensaje = mensaje & "         # " & (i + 1) & " " & DescripcionTipoAccion(acciones.item(i).Type) & vbCrLf '": Tipo -> " & acciones.item(i).Type & ", descripción ->: " &

  NEXT

  mensaje = mensaje + vbCrLf

  MSGBOX (Mensaje)

END SUB

The problem is that this does not solve all the problem: I still donot know which fields are used e.g. in "Field Select" actions or which variables are used in "Set Value" actions... I have searched all along the API document and also in forums, etc. but with no luck...

Has anyone done something like this? Or have any clue?

Thanks in advance!!!

Regards,
H

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

mwoolf posted a link that will save your day. Open the Document Analyzer in QV Desktop, select Tools->Edit Module and navigate to SUB extractActions.

Actually, it proves to be pretty simple. Just an array of unidentified parameters.The sequence position is everything.

Again, all hail to Caesar Rob

View solution in original post

7 Replies
bixpahalley
Contributor II
Contributor II

here a simple macro to create a trigger on field.  This usefull in many cases.

****************************************************************

Sub TriggerDOCAdd()

Set Qvpr = ActiveDocument.GetProperties

Set fld = QvDoc.Fields("Year")

Set fp = fld.GetProperties

' chose the trigger type on selection item

Set actions = fp.OnSelectActionItems

' Set actions = fp.OnChangeActionItems 

If actions.Count= 0 Then

    actions.Add

    actions.Item(0).Type = 31 ' variabile

    actions.Item(0).Parameters.Add

    actions.Item(0).Parameters.Item(0).v = "vYearColour"

    actions.Item(0).Parameters.Add

    actions.Item(0).Parameters.Item(1).v = "=RGB(120,123,255)"

' add a second trigger on the same field

    actions.Add

    actions.Item(1).Type = 13  ' macro

    actions.Item(1).Parameters.Add

    actions.Item(1).Parameters.Item(0).v = "MacroSelectVars"

    fld.SetProperties fp

   ActiveDocument.Save

End If

End Sub

hector_munoz
Specialist
Specialist
Author

Hi Francesco,

Thaks for the reply but what I need is to extract action configuration in existing triggers, no to create new ones...

Thanks anyway for your time!

Regards,

H

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Pretty much undocumented. Which means that there is only the QV Desktop User Interface to extract information from.

Sorry...

m_woolf
Master II
Master II

The Document Analyzer does this.Tools | Qlikview Cookbook

If that doesn't satisfy your needs, I suggest analyzing Document Analyzer the code.

hector_munoz
Specialist
Specialist
Author

Yes Peter, I think that this part is a bit undocumented. Normally you can create, with more or less effort, some useful macros that help with developments but here I have found a blind way...

Thanks!

Peter_Cammaert
Partner - Champion III
Partner - Champion III

mwoolf posted a link that will save your day. Open the Document Analyzer in QV Desktop, select Tools->Edit Module and navigate to SUB extractActions.

Actually, it proves to be pretty simple. Just an array of unidentified parameters.The sequence position is everything.

Again, all hail to Caesar Rob

hector_munoz
Specialist
Specialist
Author

Thank you very much for all the help!!!