21. Exercises
- Anthony George
Owned by Anthony George
Introduction
This chapter is designed to test the knowledge you have learned in this course using the exercises below. We will define what needs to achieve, provide minimal guidance and leave you to decide how to achieve it.
In the event, you want to reset the data you are using in your application see Clearing and Loading Data in an ERD. For a more in-depth look at this topic see Rollback Recordsets.
Exercise 1: Comments
We would like to put comments against specific orders on the Invoicing screen.
- Create a Table: Create a new table called
OrderComments
with the following attributes: - Update Invoicing Screen:
- On the Invoicing screen in the empty tile add a Comments Card from the palette → Card Containers section.
- Create a background filter linking the orders to the comments. This is needed so Comments are set for specific Orders.
- Create an Input Screen for Comments:
- Create an input screen for the order comments.
- Drag attributes from the table to create fields.
- Use the wizard to create the save and delete options for your form.
- You will need the UID and OrderID attributes for filtering and saving but these can be hidden from the user.
- Setup a background filter on the screen as follows, click to enlarge:
- We use the value
-1
as no records have this value and it stops an existing comment opening. We will use this later.
- We use the value
- Create an input screen for the order comments.
- Create an Actionflow to Open the Comment Form:
- Back on the Invoicing Screen.
- Create a new Add Comment button below the Comments card container. Select a button of your choice.
- Setup the actionflow on the button:
- The configuration is similar to the example on 18. Actions and Initiators. We pass in the OrderComments as the Driving data and lookup to see the selected Order from the Orders grid.
- As this actionflow is adding a new comment for an Order, do not map in the UID from the OrderComments. We will do that for the edit later.
- Create a lookup to acquire the OrderID from the Orders grid.
- Make sure you map the looked up OrderID all the way through or the comment will not be associated to an Order and will not show.
- Testing:
- You should now be able to add a comment and it will be associated to the selected order. Select a different order and the comment will disappear.
- When you add a second comment, the form that opens is blank and a new comment is created.
- Troubleshooting
- Remember you can only save changes to data when a screen is locked or you are in application mode.
- Ensure you have saved all your changes.
- Close and reopen the screens to ensure the actionflows and filters have been applied.
- The comments appear for all orders?
- This is an issue with the filter on the Card Container holding your comments on the Invoicing screen. Check the background filter is correct.
- The comment does not appear?
- Check the comment was actually created by opening the default view on OrderComments table. There should be an entry with the correct time and date for the comment you added.
- If there is a record with the time and date for the comment you just created:
- check the values in the record are all populated correctly. Any issues check the mappings in all of your actionflow to ensure the data is passed through.
- If all the values are populated and correct, check the background filter on your Comments card container.
- The comment appears but is empty.
- It's likely the comment has not been saved correctly. Check the comment was actually created by opening the default view on OrderComments table.
- If the data is missing for the comment check the mappings on your actionflows.
- If the data is present in the default view, the attributes are possibly not mapped. Remember if the names of your form fields on the card do not match the backing data you need to right click on your field and select a backing attribute.
- It's likely the comment has not been saved correctly. Check the comment was actually created by opening the default view on OrderComments table.
- Add an Edit button:
- On a Comment Card there is an edit button, add to it the actionflow that opens the Comment Form.
- This time on the we will map into the Actionflow the UID of the comment so we know that an update is being performed.
- On the Comment Form add a second Background Filter Rule that will filter the comment by UID if a UID is provided.
Exercise 2: New Employee
We need an input form that allows users the ability to add new or edit Employees for a specific Company. Using a similar design pattern as above complete this exercise. Consider passing across details into form headers to guide users.