Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
subin6600
Creator III
Creator III

Macro to set a trigger - need help

Hello QlikViewer's,

I have a strange request where the trigger on a object should be set with a macro.
The issue is, at times we loose the triggers, so as an exception handling we are wanting to write a macro which will set the trigger as soon as a sheet is activated. How can we achieve this??

Regards,

Subin

4 Replies
marcus_sommer

I think to create or change a trigger with macros won't be possible. But if you used a trigger to execute the macro then the macro could do these things what the triggered action would have be done.

But a trigger couldn't really be lost - are you sure the trigger isn't deleted by a human activity, directly by removing or removing / renaming from the sheet/field/variable or similar?

- Marcus

subin6600
Creator III
Creator III
Author

Hi Marcus,

Its really difficult to reproduce such issues and so don't really have an explanation as to how it had happened. So for handling such incidents in future, I was thinking to create a macro which will check if the triggers are in place and if they are missing, the macro should set the trigger.

I know its kind of being very optimistic but trying to find an answer. Let me know if you could suggest any other solution.

Thanks & Regards,

Subin

marcus_sommer

The easiest way might be to make all your requirements with macro-code. Alternatives could be to upgrade the system to the last release and/or to rebuild the complete application (sometimes a qvw get corrupted - firstly with a more or less copy + paste approach and if it don't work with more efforts for each object).

- Marcus

hagerjoachim
Contributor
Contributor

This post is ancient, but it is possible to change triggers with marcos:

SUB Aktion_bei_Auswahl
set fld=ActiveDocument.GetField("Jahr")
set fp = fld.GetProperties
set actions=fp.OnSelectActionItems
for i=0 to actions.Count-1
msgbox "Action types: " & actions.item(i).Type
next
actions.add
actions.item(i).Type = 29
fld.SetProperties fp 
' Action types enumerated as follows:
' Info=0
' Sql=1
' Lock All=2
' Unlock All=3
' Clear All=4
' Clear All Incl Locked=5
' Back=6
' Forward=7
' File Close=8
' Next Tab=9
' Prev Tab=10
' Export=11
' Launch=12
' Macro=13
' Recall Bookmark=14
' Replace Bookmark=15
' Create Bookmark=16
' Print Report=17
' Activate Sheet=18
' Print Sheet=19
' Print Object=20
' Restore Object=21
' Minimize Object=22
' Maximize Object=23
' Activate Object=24
' Select Excluded=25
' Clear Other Fields=26
' Select Possible=27
' Lock=28
' Unlock=29
' Pareto Select=30
' Set Value=31
' Field Select=32
' Field Toggleselect=33
' Open Url=34
' Document Chain=35
' Eov=36
END SUB
 
We face the same problem as described by Subin. It occurs when you open the QlikView file without data or you make alterations which results in a dataset where the field doesn't exist anymore. Then the trigger on the field gets lost, too.
- Joachim