PopUps question

So I currently have a button on a view I have made, and I also have another view that serves as a warning popup. The idea is that the button the user will press will display data on a power chart; however there are times where that data may no be able to be displayed and that is when I want the warning pop up to occur.

I have already created parameters “HasData” that is true or false depending on whether or not data can be displayed and if it is true I would like no warning pop up to show and if it is false I would like that pop up to show upon the button being clicked. However, how would I do this? I cannot find a way under the “On Click” events that I can write a short script to tell ignition to only display the pop up if the “HasData” Parameter is true. Thank you for any help in advance

Use Message Handlers.

The button will run a script that throws an event. The root of the page will have a message handler to catch the event.

You can then have the message handler eventually use system.perspective.openPopup.

Here’s a small example. ‘prmTxtPrompt’ would be a parameter in the popUpView view.

vwName = 'popUpView'
params = { 'prmTxtPrompt':msg }
title = 'RECIPE ERROR' if (error) else 'RECIPE'
logMessage('info', title, msg)
system.perspective.openPopup('puStatus', vwName, params, title)