Sometimes when the application user executes an action in one of the components of an Entity Manager other components must be refreshed.
For example, in the Customer Entity Manager the “Total Sold” attribute in the General Component must be updated when the application user adds or changes an invoice of the customer.
Refreshing the whole form is, sometimes, not the right option.
K2BTools provides a method to notify other components that need to be refreshed. Notification must be done by triggering the K2BT_RefreshEntityManager GlobalEvent.
If a component must notify others it adds the following code:
Entity Managers handle the event. They check if the <pgmname> parameter matches its name or is empty. If the parameter is not empty and different from the entity manager name the event processing stops.
Otherwise, the <componentName> parameter is checked. If it is empty, a Refresh command is executed. If it is equal to the component code for one of the components included in the Entity Manager, that component is refreshed.
If no component matches the parameter’s value, nothing happens.