I've built a small demo application with three entities:
- CUSTOMER (with just one attribute: Name)
- ORDER (with two attributes: Description and Customer)
- ITEM (with two attributes as well: Name and Order)
So the ITEM entity does have a reference to an ORDER entity which does have a reference to a CUSTOMER entity. One Customer may have several Orders associated to it and one Order may have several Items associated to it.
I've built an Item_Edit screen to edit ITEM records and to insert new ITEM records, as well.
Beyond the standard buttons (Save and Cancel), this screen contains three widgets:
- an Input widget (ItemName);
- a Combo Box widget (CustomersComboBox);
- and another Combo Box widget (OrdersComboBox).
As I want to have the OrdersComboBox widget refreshed with the Orders associated to the Customer selected in the CustomersComboBox widget, I've built up an User Action to handle CustomersComboBox "On Change" event (RefreshOrdersComboBox).
I've also completed the Preparation User Action in order to get the two Combo Boxes widgets updated with the correct values when an existant Item record is shown.
In order to get all this working, I've also defined three Local Variables:
- CurrentCustomer (contains current Customer);
- CustomerOrders (a Record List wich will contain all Order for the selected Customer);
- CurrentOrder (contains current Order).
Everything seems to work correctly except the following situation: when "New Item" is selected, the first Customer is shown in CustomersComboBox widget but the OrdersComboBox widget is empty (this widget should contain all the Orders associated to the first Customer).
Could you, please, let me know how I should correct this error?
I'd like also to take this opportunity to ask you to confirm that what I've implemented is the correct way to get the desired behaviour.
Thank you very much.
Thank you very much for your suggestion, Rafael.
Unfortunately the problem is not completed solved: the OrdersComboBox does not get updated when the New Item screen is entered (the CustomersOrderBox displays the first Customer but the OrdersComboBox is empty). However, after selecting another Customer in the CustomersComboBox, the OrdersComboBox is upated correctly (that's due to the RefreshOrdersComboBox User Action).
Beyond this error, another error occurs: after saving a new Item, the Customer and Orders values that have been selected are not saved.
I am sure that these problems are caused by my lack of knowledge on the platfform. Any guidance from you will be very helpful.