Skip to main content
May 21, 2021
Question

how to update ri! from a sub-interface?

  • May 21, 2021
  • 3 replies
  • 2 views

I have a parent interface that is calling a sub-interface. I want to use a!save() is this possible?

3 replies

natashan0002
May 22, 2021

Hello,

You will have to send ri to subinterface first.

Then use save!() in the subinterface to update it. 

This will return backthe changed ri.

davel001150
May 24, 2021

Yes, if you pass the ri! as a parameter of the rule that makes the sub-interface, then when you update the value inside that code, it will proceed to update it outside that code as well.  In your sub-interface, it can have a completely different name, but that's not recommended.  You have to a!save() into the name the parameter has in the sub-interface.

It's actually VERY good practice to explicitly label all the ways the data flows down through the nested code then back up through the nested code.  Developers can track where a starting value comes from, and where a changed value ultimately goes.

stewart.burchell
May 24, 2021

It's worth noting the conceptually any ri! parameter is simply a "pointer' to a variable. That variable needs to exist in the parent interface object (or, if there is a stack of calls, at the very top-most interface) for the value to be changed from a sub-interface.