I’m running following script in InternalFrameActivated event of the popup:
from java.lang import Thread
mixerBatchHistoryId = system.gui.getParentWindow(event).getComponentForPath('Root Container').mixer_batch_history_id
query = """
SELECT osws.id as Reason,
ocs.id as category
FROM mixer_scrap_event mse
JOIN oee_status_word_scrap osws
ON mse.oee_status_word_scrap_id = osws.id
JOIN oee_category_scrap ocs
ON ocs.id = osws.oee_category_scrap_id
WHERE mixer_batch_history_id = %d
"""%(mixerBatchHistoryId)
scrapExists = system.db.runQuery(query, 'strvsqlp31')
print query
data = system.dataset.toDataSet(scrapExists)
if scrapExists:
system.gui.getParentWindow(event).getComponentForPath('Root Container.scrap.category').selectedValue = data.getValueAt(0, 'category')
system.gui.getParentWindow(event).getComponentForPath('Root Container.scrap.reason').selectedValue = data.getValueAt(0, 'Reason')
else:
system.gui.getParentWindow(event).getComponentForPath('Root Container.scrap.category').selectedValue = -1
system.gui.getParentWindow(event).getComponentForPath('Root Container.scrap.reason').selectedValue = -1
The Reason is depended on the category dropdown.
When I try to execute, it does selects appropriate category but not the reason !