SQL Query Binding question

I have a label’s text field bound to a SQL query. The query is below:

select recipe_running
from furnace_loads
where id = {Root Container.Equipment Schedule.selectedEvent}

The id value is being supplied by a component property of an Equipment Schedule component. The SQL query works as expected when there’s an event actually selected, but ignition is throwing up an error when the form loads. This is because the selectedEvent is a null value at that point (nothing selected on the equipment schedule component). This causes the database to error on the query.

Is there a way to disable the query from running if the .selectedEvent property is empty? Or to supply a dummy variable inside the SQL query binding?

Create an integer custom property and use the coalesce expression function to convert the null to a dummy integer.

That’s working, thanks!