Salesforce

How Do I Implement a One-to-Many Relationship? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Implement a One-to-Many Relationship? (Magic xpa 3.x)

Setting up multiple tables within one HTML screen can be tricky if you are doing it manually, but it is easy using the browser-client. You can set up one or more subforms, and use a separate Magic xpa task to handle each subform independently. If the data is connected, as it is in our example, then when the data in one form changes the subform data will also change automatically.

There are three steps to setting up a one-to-many task:

  1. Create the header task.

  2. Create the subtask.

  3. Tie the header and subtask together with a Subform control.

Let’s go through these one at a time.

1. Create the Header Task

  1. Create the header task as you would any other Browser-client task. In our example, we are displaying one Order header record.

  2. On the Order header form, create a table entry in the location you want your repeating data. Be sure to give the table an id, as this will be used in the next step.

2. Create the subtask

  1. Create your subtask as you would any Browser-Client task, selecting the fields you want to display on the form.

  2. Select the same HTML page that you used in your parent task.

  3. Create one HTML control of type Table. This control will have the same name as the id= in the HTML table control.

  4. In the Control Properties for the table, set the Details line # property to indicate which line you want to have repeat. In this case, the first line of the HTML table is the header line, so the second line is the one we are repeating.


  5. In the Form Properties, set the Repeated lines property to show how many times you want the line to repeat.


  6. Add controls for each of the data items you want to put on the table.

  7. Set up arguments to control the Range and Locate of the task, as you would for any task. In our example, we pass in the start mode and order number, so the order lines only show for the current order and the mode matches that of the parent.

3. Tie the header and subtask together with a Subform control

  1. Last, you will add a Subform HTML control to your parent task. Press F4 to add a line to the HTML Controls, then select Subform in the Type column.

  2. In the HTML Control properties, set the Connect to to Subtask if you are calling a subtask, or Program if you are calling a program.

  3. In the PRG/TSK num field, zoom to select the subtask or program you are calling.

  4. In the Arguments field, zoom to set the arguments you are passing to the called task. In our example, we are passing the mode and order number, so that the subform displays the order lines for this order, in the same mode as the parent task. This methodology is the same as that used in using subforms in online tasks, as explained in the Subforms chapter.

Now when the main task is called, it will automatically display the subtask form as well.

Reference
Attachment 
Attachment