Previous Topic: Match ViewsNext Topic: Defining Business Systems


Edit Action Diagram

We still need to read the golfer's scoring records and move them to the local group view. However, prior to doing that we can clean up the existing diagram a little bit.

Follow these steps:

  1. In the update of the golfer, the handicap index is being set to the import golfer handicap index. We want to set it from the local iglf1 golf scoring record handicap index, which was returned from the component. Double-click import golfer handicap index in the SET statement. In the Change dialog, select numeric view, select local iglf1 golf scoring record, and then select the Change push button. Note that since the handicap index was the only numeric attribute in that view, the Toolset selected it for us automatically.
  2. Now we can delete handicap index from the import view, since it is no longer being used. In addition, while we are at it, the value of user ID in the export view will be the same as the value in the import view, so it is not necessary to export it again. Delete userid from the export view.
  3. Now we can read each of the golfer's last 20 scoring records and populate the local group view with them. Since we need more than one occurrence of a scoring record, we use a group view. A group view is used to establish an array. You add the group view, set its occurrence properties, and then add any other views required to the group view. All of the views within the group view will occur however many times specified in the occurrence property.

    Double-click Group View in the Locals: view to open the group view's properties dialog (the Detail Local Group View dialog).

    Gen--Edit Action Diagram

    From here, you can change the name of the group view.

    Note: This group view occurs One or More times. Virtually all group views do. However, you can have a group view that occurs only once, which is the default when adding a new group view. If they occur one or more times, then you can specify how many more times. Since we need the last 20 scoring records, we have made this group view at most 20.

    Group views can be explicitly or implicitly indexed. If they are explicitly indexed, then you need to maintain a subscript to the appropriate position in the array. The first position in the array is at location 1. If a group view is implicitly indexed, then CA Gen will control the positioning in the array starting from position 1. After you have done something with the attribute values in the first position, CA Gen will automatically increment the subscript to 2, and so on.

  4. Change the type of indexing used for this group view to Implicit. Select the OK push button.
  5. To read each of the scoring records, we need an entity action view of scoring record. Select ENTITY ACTIONS:. Then, from the Menu Bar, select Edit, then select Add View, and then select Add Entity View. In the Add Entity Action Entity View dialog, select entity SCORING RECORD, select all of the attributes except NOTE, and then select the OK push button.
  6. Now we can write the Read Each statement. Select the WHEN successful condition of the read of golfer. Then, from the Menu Bar, select Edit, select Add Statement, and then select Read Each….

    Note: This time the Toolset does not automatically fill in the entity view for us. That is because we have two entity action views that can be read.

  7. Select scoring record. Select the Qualify push button. Select Targeting group view. Targeting statements are used to initialize the internal subscript of implicitly indexed group views. We want the most recent 20 scores, so select Sorted Descending, select date, select Sorted Descending again, select time, select Where expression, select relationship view, select DESIRED persistent view, select is maintained by CURRENT golfer, and then select the Add push button.
  8. With the READ EACH statement still highlighted, from the Menu Bar select Edit, select Add Statement, select Set…, select attribute view, select local group iglf1 golf scoring record, select adjusted score, select NOT ROUNDED, select TO expression, select numeric view, select scoring record, select adjusted gross score, and then select the Add push button.
  9. With the new SET statement still highlighted, from the Menu Bar select Edit, select Add Statement, select Set…, select attribute view, select local group iglf1 golf scoring record, select course rating, select NOT ROUNDED, select TO expression, select numeric view, select scoring record, select course rating, and then select the Add push button.
  10. With the new SET statement still highlighted, from the Menu Bar select Edit, select Add Statement, select Set…, select attribute view, select local group iglf1 golf scoring record, select slope rating, select NOT ROUNDED, select TO expression, select numeric view, select scoring record, select course slope rating, and then select the Add push button.
  11. Save the model.

    The completed action diagram should look as follows:

    Edit Action Diagram

  12. Close all of the diagrams but not the Toolset.