Hi
I want to update the parameters of one entity from a different entity.
For example, i have a table of materials at project level and i want to add some materials to this table from a child entity.
Is this possible and how?
Thanks in advance
Hi
I want to update the parameters of one entity from a different entity.
For example, i have a table of materials at project level and i want to add some materials to this table from a child entity.
Is this possible and how?
Thanks in advance
Hi Natalie,
In short: yes you can! If you use the API you can find the parent entity: parent = entity.parent()
. The result of that call (grand_parent
) is an object of the type Entity
, on which you can get the params through parent.last_saved_params
. Manipulate those params and then use the set_params
class like this. So, something like this would do what you ask:
parent = entity.parent()
new_params = parent.last_saved_params
new_params.update({'specific_field': new_value})
API().get_entity(parent.id).set_params(new_params)
Warning: you have no control over the parent entity in the sense that if it has an editor and someone is using it, this overwrite of params from a child entity can cause strange behaviour. I understand your question, but I would advise you to seriously consider if this is indeed exactly what you want to do. Are there no other ways to get what you want?