Hello again,
I am populating a dropdown list using a select query:
Select [id],[TapeNo]
from [Tape]
There are no null values in the Tape table allowed. However, I would like for there to be a “none” selection option in the dropdown list with a “Selected Value” of -1 (i.e. no selection). Since that “none” selection doesn’t exist in the result set, I should probably be manually adding it in. But I don’t see any property of the dropdown list that can do that, so how could I go about it?
Use your database’s Union All syntax. Something like:Select -1 As Id, 'None' as TapeNo
Union All
Select Id, TapeNo
From Tape
Side note: Quoting requirements vary by database brand. The square brackets are specific to SQL Server, but SQL Server does support using double quotes for identifiers, per the SQL standard. It’s a good habit, in case you ever need to use another platform.
1 Like
Yes this solution would work
however I forgot to mention that I am executing the procedure as a stored procedure from the database
it looks like:
exec dbo.readTape
so a union all returns a syntax error when it sees “exec” instead of select. Is there a way to union the null row with the result set from the stored procedure? Or would I have to change the way I’m doing things? I prefer to leave the stored procedure as is, and instead add the null row from ignition.
Ok. I would bind the stored procedure to a custom dataset property, then add the dummy row in a property change event that wrote the updated dataset to the .data property.
I will try this approach, thanks 