Hello everyone:
I'm new here and a total enthusiast... looking for solutions before publishing a post.
I have tried in various ways to change all the values of a specific column, depending on the value I select in a specific dropdown.
I'm doing this to make the operational work easier for the end user, since selecting 1 x 1 each row is a bit tedious, so the best solution I found (and I hope I'm right) is to implement a dropdown that can change all the columns as needed (attached photo)
my code on propertychange from dropdownlist its here, please dont judge me, im really newbie
I was trying to select the whole table and with jide_table.setValueAt(i, 5, new_value) where 'i' corresponds to the position of the row, 5 to the column I want to change and new_value to the value selected in the dropdown...
It should be noted that I am receiving data from sql, and adding columns in the same select.
I really appreciate the help provided, I have not found anything similar
Greetings
If they are going to be the same for every row, don't include them in the table. Make entry fields or dropdowns for them separately (upper right, perhaps). No need to include placeholders in the SELECT either, if you do this separately.
The problem with changing the data i the table is that when the query retriggers all your changes are gonna be lost.
I dont think vision has transform scripts, but i guess you will have to either update the database immediatly (seems kinda bad)
or create a script (in the onchange?) of the query and the drowdows, which is not yet the table paramter, and let that script write to the table.
Also the one thing i know in vision property change events is that they trigger on EVERY property change, so always, always make sure to first check what property has changed, before executing any other code
the first lines in your onchange script should always be:
if event.propertyName != "selectedValue":
return
Hello pturmel, nice to greet you.
They won't always be the same for all fields, that was my solution above.
I look for with these dropdowns that ALL the rows of a column are modified, and in the case that the user wants to change, 1, 2, 3 specific rows can also do it..
Attached as I did before (and it is what you tell me).
It's not the closest thing to what I'm looking to do...
It is not so important that the modifications are "lost" since they are only in the dataset of the power table and not in the database as such...
When the operator presses "add" is what matters to me.
I am looking to add a new user with specific rows and the operator can be wrong more than once, so there is no problem if it is "change on dataset is lost"
I understand that this must be in the propertychange of the dropdownlist,
but how to modify all values of all cells of a specific column? what am i looking to do
https://docs.inductiveautomation.com/display/DOC81/system.dataset.setValue
table = event.source.parent.getComponent("Table")
# Make a new dataset with an updated value
newData = system.dataset.setValue(table.data, 3, "lname", 7)
# Repalce the table's dataset with our new dataset
table.data = newData
1 Like
Thank you very much, this has guided me finally leaving my dropdown like this
1 Like