Multiple selection in table then input same result

Hi, is it possible in a table to select multiple row then input same result(drop down list) with the selected row in this table.

Thank you so much

Hmm. Interesting. The view() function in my Simulation Aids module can extract a subset of the table data based on the selectedRows property of the table. However, that property isn’t bindable, so it’s hard to make the view function update as the selection changes. Try this expression on your Dropdown’s data property:view("Select WO_, Product_Type Where _r in binding.target.parent.getComponent('Table').selectedRows", {Root Container.Table.data}, {Root Container.Table.selectedRow})Including ‘selectedRow’ in the list of arguments will make the result update as the first selected row changes. It’s not immediately obvious how to make this work overall.
{Put this expression on the data property of a second table if you want to see it’s operation more clearly.}

One thing I’m not clear on: is the drop down list part of the table or is it a separate component?

Add this code to your table’s mouseReleased event:dropdown = event.source.parent.getComponent('Dropdown') system.db.refresh(dropdown, 'data')It’s not documented, but system.db.refresh() isn’t limited to database queries – any binding will update. With this and the above, the dropdown’s dataset will update as you highlight rows from high to low, and will update when you release the mouse after highlighting rows from low to high.

The Drop down list part in Table which is a column result, with the list of passed or failed.

What I did now is I added a two button which is passed and failed, once the user select multiple row then click the button passed. all the selected Work order will have a passed result.

my code in a passed button:

[code]import sys

selectedRow = event.source.parent.getComponent(‘Table’).selectedRow
selectedRows = event.source.parent.getComponent(‘Table’).getSelectedRows()

table = event.source.parent.getComponent(‘Table’)
data = event.source.parent.getComponent(‘Table’).data
RecordID = str(event.source.parent.RecordID)
WO_Num = str(data.getValueAt(selectedRow, “WO_Num”))
LabTimeOut = str(event.source.parent.getComponent(‘TimeL’).text)
Remarks = str(data.getValueAt(selectedRow, “LabComment”))
system.db.runUpdateQuery(“UPDATE OT_Trolley_Allocation SET Status = ‘Passed’, LabComment = '”+ Remarks +"’ WHERE WO_Num = ‘" + WO_Num + "’")
system.db.runUpdateQuery(“UPDATE OT_Allocation_Status_History SET LabOut = '”+LabTimeOut+"’, LabResult = ‘Passed’, LabRemarks = ‘"+ Remarks +"’ WHERE WO_Num = ‘" + WO_Num + "’ and RecordID = ‘"+ RecordID +"’")[/code]

but only one row has been changed, one last selected work order has a passed result if I click the button.

All right then!

You need two things.

First, iterate through the selectedRows and build a list of work orders.
Second, change the update queries to use this list.

[code]import sys

selectedRow = event.source.parent.getComponent(‘Table’).selectedRow
selectedRows = event.source.parent.getComponent(‘Table’).getSelectedRows()

WO_List = []
for row in selectedRows:
WO_List.append(str(data.getValueAt(row, “WO_Num”)))

#remove brackets
WO_Num = str(WO_List[1,-1])

table = event.source.parent.getComponent(‘Table’)
data = event.source.parent.getComponent(‘Table’).data
RecordID = str(event.source.parent.RecordID)
LabTimeOut = str(event.source.parent.getComponent(‘TimeL’).text)
Remarks = str(data.getValueAt(selectedRow, “LabComment”))
system.db.runUpdateQuery(“UPDATE OT_Trolley_Allocation SET Status = ‘Passed’, LabComment = '”+ Remarks +"’ WHERE WO_Num IN (" + WO_Num + “)”)
system.db.runUpdateQuery(“UPDATE OT_Allocation_Status_History SET LabOut = '”+LabTimeOut+"’, LabResult = ‘Passed’, LabRemarks = ‘"+ Remarks +"’ WHERE WO_Num IN (" + WO_Num + “) and RecordID = '”+ RecordID +"’")[/code]

The WHERE IN clause allows you to use a list of values.

Thank you so much for that. I appreciate the help.
but I got an error like this.
at line 15 [code]import sys

selectedRow = event.source.parent.getComponent(‘Table’).selectedRow
selectedRows = event.source.parent.getComponent(‘Table’).getSelectedRows()
table = event.source.parent.getComponent(‘Table’)
data = event.source.parent.getComponent(‘Table’).data
RecordID = str(event.source.parent.RecordID)
LabTimeOut = str(event.source.parent.getComponent(‘TimeL’).text)
Remarks = str(data.getValueAt(selectedRow, “LabComment”))
WO_List =
for row in selectedRows:
WO_List.append(str(data.getValueAt(row, “WO_Num”)))

#line 15
WO_Num = str(WO_List -1, 1)
system.db.runUpdateQuery(“UPDATE OT_Trolley_Allocation SET Status = ‘Passed’, LabComment = '” + Remarks + “’ WHERE WO_Num IN '” + WO_Num + “’”)
system.db.runUpdateQuery(“UPDATE OT_Allocation_Status_History SET LabOut = '” + LabTimeOut + “’, LabResult = ‘Passed’, LabRemarks = '” + Remarks + “’ WHERE WO_Num IN’” + WO_Num + “’ and RecordID = '”+ RecordID +"’")[/code]

when I add a bracket in line 15 code

WO_Num = str(WO_List [-1, 1])

got an error