update of related records

In the same table I have some records linked together by a relationship.
I would like to update some field when the user change its content, using the onChange property.

This method with the element name works fine, but I would like to set the element name as a parameter for using it in several fields without change it.

var fieldname = elements[application.getMethodTriggerElementName()]
var fieldvalue = fieldname
var fsUpdater = databaseManager.getFoundSetUpdater(id1_to_id1)
fsUpdater.setColumn(fieldname,fieldvalue)
fsUpdater.performUpdate()

This or similar code don’t work, I lack in javascript knowing…

I’m not clear on what you’re trying to accomplish. Can you give a better explanation/example of what you want to do?

using the FoundSetUpdater, I would like to update related records but using element name and field data into variables captured by the onDataChange function.

first of all, this:

var fieldname = elements[application.getMethodTriggerElementName()]

will not give you the fieldname.. But the element itself so the component itself!

Then name you already have: application.getMethodTriggerElementName()

second then you just assign the fieldname value (which is the component itself) to the fieldvalue… (so both things are exactly the same)

then with those 2 variables that holds the same value you call setColumn…
i think want you want is something like this:

var fieldname = elements[application.getMethodTriggerElementName()].getDataProviderID()
var fieldvalue = controller.getDataProviderValue(fieldname);
var fsUpdater = databaseManager.getFoundSetUpdater(id1_to_id1)
fsUpdater.setColumn(fieldname,fieldvalue)
fsUpdater.performUpdate()

only this still won’t work because is the field a related data?
That is data from that id1_to_id1 ??
Then the fieldname is something like: id1_to_id1.XXXXX ?
then you have to strip that from the fieldname before saying setcolumn.