22. Exercises
- Anthony George
- Zoe Baldwin
Introduction
This chapter is designed to give you the opportunity to try out the knowledge you have gained from this course.
If you need 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
Provide the ability to place comments against specific orders on the Invoicing screen.
This should look similar to:
With a popup input form which allows a user to enter a comment:
Perform the following:
- 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 opening a form (to add a new comment to 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 we will map the UID of the comment into the Actionflow 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 a new Employee for a specific Company.
It is recommended this be added to the Employees card on the Company Data screen, as follows:
The details of the new employee can then be added in a popup form, similar to the one you see here:
The solution for this is very similar to the one used in exercise 1 above. Consider passing across details into form headers to guide users, for example which company the Employee is being added to.