I have a Dropdown object on one of my windows, this object is populated by a Named Query.
This Dropdown is how a PDF is selected for the PDF Viewer.
While in test mode everything works just fine, when I actually run with a Client everything works just fine except when I leave(close) this window and move to another.
I get a scripting error - it tells me that a null value can’t be used to open the pdf.
So I’m assuming the the property change event fires for the dropdown when the window closes and this is why I get the NULL error (Nothing has been selected) But how do I handle this error so my program will work correctly.
Here is my script for the Dropdown object
# Check to see if the property that changed was the Selected Value property.
if event.propertyName == "selectedValue":
# Run the query to grab the file name and bytes using the new selected ID value.
event.source.data = system.db.runNamedQuery("Sample2", {"fileid":event.source.selectedValue})
# Grab the file bytes and name from the same row.
bytes = event.source.data.getValueAt(0, "data")
name = event.source.data.getValueAt(0, "filename")
# Load the bytes into the PDF Viewer component.
event.source.parent.parent.getComponent('Container').getComponent('PDF Viewer').loadPDFBytes(bytes, name)