Solved

data adjustment that invoke multiple uponchanges

  • 5 September 2023
  • 1 reply
  • 27 views

Userlevel 1
Badge +4

Does AIMMS store the information after an user triggers multiple upon change procedures.

For example, 2 parameters are in a UI table and an user uses block editing to change both parameter , both wiht their own upon change procedure.

Can you know as a developer during the first one that called that also a second will be called later.

(i know the order depends on the model tree)

icon

Best answer by luispinto 7 September 2023, 10:21

View original

1 reply

Userlevel 4
Badge +6

We already discussed this in another channel, but I want to share some of the insights here.

As an AIMMS developer you do not have access to the call stack for “future upon change procedures”. 

Here is an alternative:

  • In your upon change procedure (say pr_uponChanges), set a flag so you know that this was triggered
  • Use ScheduleAt to schedule a procedure (say pr_applyChanges) for the very near future (some seconds?) that will effectively apply the upon changes you want. You can even check if this has already been done by looking at the above mentioned flags.
  • In pr_applyChanges, verify all flags and apply the changes that are needed, avoiding double calls.
  • Reset all the flags to 0

This way, you can track all the upon changes that were run and only run the apply changes once, while still being able to track which values changed.

Ref.:

https://documentation.aimms.com/functionreference/system-interaction/invoking-actions/scheduleat.html

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator