Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
erichshiino
Partner - Master
Partner - Master

Macro to disable triggers

Is it possible to disable triggers using macro?

I´d like to disable triggers (like onSelect, onLock) when making selections with macro. After this I'd like to enable them back.

19 Replies
erichshiino
Partner - Master
Partner - Master
Author

Did you get the user? Try to include a message to test it:

Sub UserSetting()

User=Lcase(ActiveDocument.

GetLayout.AuthenticatedUser)


msgbox (User)

set fld=ActiveDocument.GetField("OSUSER")
set fldprop=fld.GetProperties

.....

Not applicable

oh yes Erich, I get the user (checked with the msgbox)

I'm still investigating but I think that there is some limitation to set and remove actions when it is executed in the server.

Not applicable

Amazing investigation.


The instruction not working in the server is:

ActiveDocument.Fields("OSUSER").Unlock

Most amazing is that the RemoveAt(i) instructions are working correctly (msgbox actionsfld.Count displays 2 before and 0 after).

Any ideas?

erichshiino
Partner - Master
Partner - Master
Author

Are there any actions associated with the unlock at this point of the macro?

Because if there is something there already, it would call the action before continuing with your code...

Not applicable

Erich,

Try the attached document: first in your desktop and then in the server.

erichshiino
Partner - Master
Partner - Master
Author

Sorry, I'm only able to try it on desktop.

And it works...

What if you unlock it twice?

After Unlock, try to check if it's locked with

temp=ActiveDocument.Fields("CITY").GetLocked

if temp then msgbox("Locked!")

You can also use this:

temp=ActiveDocument.Fields("CITY").CanUnlock

if temp then msgbox("Can be unlocked")

I saw this method on the API guide, but I'm not sure about the results.

This tests are very interesting, please tell us your results.

We can think in some workaround if it doesn't work

Regards,

Erich

Not applicable

Afirmative:

I have added both messages after the lock instructions and when I run it in the server I get the messages "Locked" "Can't be unlocked"

Very strange!

Not applicable

At the moment this issue has been reported as a possible bug.

Not applicable

Hello!

I have decided to use this macro to hide confidential info from some users... long story. The macro works great in QV developer! Many thanks for which.

Unfortunately, the macro that is supposed to add actions when entering the tab and remove them after leaving the tab works in QV Desktop only. When I try it on server, it is not executed properly (cannot add actions, but the rest of it is executed properly (I tried with message boxes)).

Is it confirmed to be a bug, or still under investigation? Any patch available so far?

It is very important for me to disable "unlock and clear" only on a single tab, so that the user sees only data which is selected by a trigger/macro and to be unable to clear this selection. On all other tabs the user should be able to manipulate the same field.

Not applicable

Here is the part of the documentation the QlikView Support used to prove that this is not a bug, but rather a work as designed functionality:

"29.2 Macro functionality limitations

Functionality that will normally work well in macros in the QlikView Server environment

with any type of client is:

• Logical operations such as clearing or selecting in fields

• Operations related to variables

The following types of functionality are not to be used in the QlikView Server environment

, as they may cause unexpected results:

• Layout operations acting on the properties of sheets and sheet objects via

SetProperties

• Operations changing document or user settings

• All operations related to the script, including Reload

• Data reduction operations, e.g. ReduceData

• Operations such as Save and Open document "

Hopefully this will save you time and efforts!

Best regards,

Sergey