21. Exercises

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.

  1. Create a Table: Create a new table called OrderComments with the following attributes:
  2. Update Invoicing Screen:
    1. On the Invoicing screen in the empty tile add a Comments Card from the palette → Card Containers section.
    2. Create a background filter linking the orders to the comments. This is needed so Comments are set for specific Orders.
  3. Create an Input Screen for Comments:
    1. Create an input screen for the order comments.
      1. Drag attributes from the table to create fields.
      2. Use the wizard to create the save and delete options for your form.
      3. You will need the UID and OrderID attributes for filtering and saving but these can be hidden from the user.
      4. Setup a background filter on the screen as follows, click to enlarge:
        1. We use the value -1 as no records have this value and it stops an existing comment opening. We will use this later.
  4. Create an Actionflow to Open the Comment Form:
    1. Back on the Invoicing Screen.
    2. Create a new Add Comment button below the Comments card container. Select a button of your choice.
    3. Setup the actionflow on the button:
      1. 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. 
      2.  
      3. 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.
      4. Create a lookup to acquire the OrderID from the Orders grid.
      5. 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.
  5. Testing:
    1. 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.
    2. When you add a second comment, the form that opens is blank and a new comment is created.
  6. Troubleshooting
    1. Remember you can only save changes to data when a screen is locked or you are in application mode.
    2. Ensure you have saved all your changes.
    3. Close and reopen the screens to ensure the actionflows and filters have been applied.
    4. The comments appear for all orders?
      1. This is an issue with the filter on the Card Container holding your comments on the Invoicing screen. Check the background filter is correct.
    5. The comment does not appear?
      1. 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.
      2. If there is a record with the time and date for the comment you just created:
        1. 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.
        2. If all the values are populated and correct, check the background filter on your Comments card container.
    6. The comment appears but is empty.
      1. It's likely the comment has not been saved correctly. Check the comment was actually created by opening the default view on OrderComments table.
        1. If the data is missing for the comment check the mappings on your actionflows.
        2. 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.
  7. Add an Edit button:
    1. On a Comment Card there is an edit button, add to it the actionflow that opens the Comment Form.
    2. This time on the we will map into the Actionflow the UID of the comment so we know that an update is being performed.
    3. 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.