Exercise - Migrated Style Parameters
- Create a new UIController name it ShowCustomers.
- Set the Customers Entity as the main table.
- Add 2 local columns:
- type NumberColumn name NumberOfOrders.
- type NumberColumn name TotalFreight.
- Add these columns to the form (Do not use a grid):
- From Customers
- CustomerID.
- CompanyName.
- ContactName.
- Local column NumberOfOrders.
- Local column TotalFreight.
- From Customers
- Add a new menu entry and call ShowCustomers.
- Save changes to Git.
- Build and test.
- Add a new BusinessProcess name it CalcTotalOrdersPerCustomer.
- Set the Orders Entity as the main table.
- Add 3 local columns:
- type TextColumn name CustomerID.
- type NumberColumn name NumberOfOrders.
- type NumberColumn name TotalFreight.
- Add Where after the From, to show only records equal to the CustomerID local column.
- In the Run method receive 3 Parameters and do:
- TextParameter name pCustomerID use the BindParameter method to connect the parameter and the local column CustomerID.
- NumberColumn name pNumberOfOrders.
- NumberParameter name pTotalFreight use the BindParameter method to connect the parameter and the local column TotalFreight.
- After the call to Execute, update the pNumberOfOrders value with the local column NumberOfOrders value.
- Override the OnLeaveRow.
- set NumberOfOrders value to increase by 1 for every row.
- set TotalFreight value to accumulate the value of Freight column from the Orders table.
- Save changes to Git.
- Build and test the BusinessProcess using the ShiftF3 send ANATR and check the Output panel for the results.
- In ShowCustomers add a button to the screen, set the button text to Get Total Orders.
- set the value of NumberOfOrders and TotalFreight to zero.
This should be done before the call to CalcTotalOrdersPerCustomer - Call the CalcTotalOrdersPerCustomer from the button click event and send the parameters.
- Save changes to Git.
- Build and test, notice that NumberOfOrders and TotalFreight are update with values when clicking the button.
- In ShowCustomers view, find the call to CalcTotalOrdersPerCustomer.
- Try to change the second parameters NumberOfOrders and send its Value, notice the error.
- Cancel the last item change and try to do the same for TotalFreight notice that you will not get an error.
- Save changes to Git.
- Build and test, notice that TotalFreight is not update when you click the button.
Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com