-
Notifications
You must be signed in to change notification settings - Fork 0
Relational variable management
Throughout the model execution process we use PyRAL to set relational variables which, are in fact, tcl variables in TclRAL.
For example, we might want to look up information about the executing Lifecycle State Activity and save it for future reference.
So we use PyRAL to restrict the appropriate Lifecycle_Activity relvar on an Anum (activity number) and domain (domain name).
R = f"Anum:<{anum}>, Domain:<{self.state_machine.domain.name}>" Relation.restrict(db=mmdb, relation='Lifecycle Activity', restriction=R) lifecycle_activity_r = Relation.rename(db=mmdb, names={"Anum": "Activity"}, svar_name=rv_name)
This yields a relation with a single tuple representing information about our Lifecycle Activity, like this:
-- Lifecycle_Activity --
+--------+---------------------+---------------------------+
| Anum | Domain | Executing_instance_flow |
+========+=====================+===========================+
| A40 | Elevator Management | F1 |
+--------+---------------------+---------------------------+
We could just save the result of that query in a python structure. This is useful when we want to pick data out of any returned tuples. For example, we might want to grab the label of the executing instance flow (the instance executing our activity) and save it as a python variable.
But we often want to retain the original query result as a relation variable in TclRAL so that we can use it as a jumping point for more queries. We may want, for example, to apply a semijoin relational operation using our
Copyright © 2025-2026, Leon Starr at Model Integration, LLC under the MIT Open Source License