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: 
rustyfishbones
Master II
Master II

Macro to Disable an Alert

Hi All,

I have an Alert that sends an email each time the QVW reloads, but some days I maybe testing and I will reload many times.

I want to create a button on the front end to disable the Alert.

Something like

SUB disablealert

ActiveDocument.GetAlert("AL04").Enabled = false

END SUB

But this is not working

Regards

Alan

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Please check the attached sample qvw.

View solution in original post

13 Replies
salto
Specialist II
Specialist II

Hello Alan,

     Haven´t tried anything similar but, maybe setting the condition of the Alert to False can disable it while you are testing.   Does this make any sense?

rustyfishbones
Master II
Master II
Author

Hi SLATO,

I know I can do that, but I wanted to create a button to disable it without having to go to

Tools >> Alert and Unticking the Enabled Tick Box

I want a button to trigger the macro to do this, lazy I know!

Regards

Alan

rustyfishbones
Master II
Master II
Author

Am I even close with the Macro I am Attempting to change

rustyfishbones
Master II
Master II
Author

I also tried the following, but still no Joy

2014-08-29_1045.png

tresesco
MVP
MVP

Set a variable on button click and use that variable value as alert condition.

marcus_sommer

Maybe you could set or modify the conditions from alert with an additionally variable - abe a look on this example from APIGuide.qvw:

rem create new alert

set docprop = ActiveDocument.GetProperties

set al = docprop.Alerts

al.Add

no = al.Count-1

al.Item(no).Action.Id = "AL03"

al.Item(no).Action.Message.v = "Hello world!"

al.Item(no).Comment = "New alert"

al.Item(no).Condition.AllClear  = false

al.Item(no).Condition.BookmarkId  = "BM01"

al.Item(no).Condition.Condition.v  = "sum(Sales)>Sum(Budget)"

al.Item(no).Enabled = true

al.Item(no).Triggers.Interactive = true

al.Item(no).Triggers.OnPostReload = true

ActiveDocument.SetProperties docprop

- Marcus

rustyfishbones
Master II
Master II
Author

Can you give any further information!

rustyfishbones
Master II
Master II
Author

Hi Marcus,

I looked at the API Guide still can't get it working

Regards

Alan

tresesco
MVP
MVP

Please check the attached sample qvw.