Push Data from a Form to a Data Repeater
  • 06 Oct 2021
  • 6 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Push Data from a Form to a Data Repeater

  • Dark
    Light

Overview

In Decisions, a Data Repeater displays the data of a Data Structure as a component on a Form. End users may manipulate the data within the Data Repeater as well as transfer data from the Form into the Repeater within the same Form session. 

The following example demonstrates how to accomplish this transfer with Data Flows.

Example

Building the Form, Data Repeater, and main Flow

For this example, the Form prompts the user-input for 'tax' and pass that value into a Data Repeater presenting invoice information for different companies. The Repeater then reflects the tax next to the sub-total of each company invoice. An Event Button on the Repeater calculates the total given the sub-total and tax from the Form. 

This example uses a Database Structure called 'Invoice' with company, sub-total, tax, and total as data members.

New to Data Structures?
Please refer to the About Data Structures article for more information.
  1. In a Designer Folder, select the Create Form button from the bottom Action bar. Choose the default template and provide a name for the Form then select CREATE.
  2. Once the Form Designer opens, search and populate the Form with the following components: a Number Box, a Button, and a Data Repeater.
  3. Name the Number Box 'Enter Tax' with a Label by submitting with SHIFT+ENTER.
  4. Select the Data Repeater component to view its Properties tab. Under the Common Properties section, locate the Source box and select CREATE.

  5. In the Data Repeater Designer, locate the Form Data section of the Properties and designate the Input Type using the appropriate Data Structure.
  6. Switch the Data Repeater's layout from the default Canvas to Grid. 
  7. Add three Number Boxes to show the sub-total, tax, and new calculated total. Then add the Event Button which will act as the trigger to calculate the total. Components added to the Data Repeater that receive data should have their data name defined using the Pick From Data button so the corresponding attribute references the source. Once the Repeater is created, save and close the Designer. Follow the GIF below for reference with the Data Repeater build. 

  8. In a Designer Folder, select the Create Flow button from the bottom Action bar. Choose the default template and provide a name for the Flow, then select CREATE. 
  9. Search and add the Get All Invoice step and connect it to the Start step. This step acts similarly to the Get All step except it specifies the Invoice Database Structure.
  10. Add a Show Form step to the Flow and connect the outcome path of the Get All step to it. Pick the Tax Form created earlier so that the corresponding inputs will populate on the Show Form step. 
  11. Select the Show Form step icon to populate the Properties tab. Use the Edit Input Mappings button to map the invoice Results list to Invoice Repeater and the Count of invoices to selected Invoice Repeater Line Number.


Building the Data Flows

Now that the Form containing the Data Repeater is configured to retrieve the invoice results in the main Flow, Data Flows must be configured to pass the Form data to the repeater and calculate the total. 

  1. In the Form Designer, open the Form Properties > Form Rules and select the Add New button under the Data Flows box.
  2. In the Edit Data Flow window, prioritize the Flow box. Create and name new Data Flow to pass the tax from the main Form into the Data Repeater.
  3. In the Flow Designer, connect the outcome path of the Start step to the End step. 
  4. Select the Start step to open its Properties, then locate the Flow Input Data section and select the Show Editor button. 
  5. In the Data Definitions window, add a piece of input data called 'Tax' of the data type 'Decimal'.
  6. Select the End step to open its Properties, then locate the Output section. Choose 'Tax' from the Pick From Current Data box. 
  7. Once the configurations are complete, save and close the Flow.
  8. Back in the Edit Data Flows window, select the Update Inputs button to view the data from the Flow so that the data from the Flow appears.
  9. Select the pencil icon next to 'Tax' in the Flow Inputs box. When the window appears, choose Form Component from the Input Type dropdown list then choose Tax from the Form Data Name dropdown list. 
  10. Enable RunOnValueChanged, then select OK.
  11. Select the pencil icon next to Flow: Tax in the Flow Outputs section. When the window appears, change the name to Form Data.Tax to match the name of the tax component in the Data Repeater. 
  12. Enable the option to refresh all of the components listening to this Data Name so that the tax will be updated when the end-user enters it. Select OK once complete.
  13. In the Advanced section, select the option to Run at Startup. Once complete, select OK.
  14. Hover over the Data Repeater Form component and select Edit Source
  15. In the Data Repeater Designer, navigate to the Properties > Form Rules. Select the 'Add New' button to create a new Data Flow for the Repeater. This Data Flow will calculate the total. 
  16. Select the Start icon to open its Properties. Select the Show Editor button for Flow Input Data to add SubTotal and Tax of the 'Decimal' data type.
  17. Select the Multiply step and map the inputs so that value is SubTotal and by Value is Tax. The output result of this will be used to finalize the calculation. 
  18. Select the Add step and map the inputs so that value1 is SubTotal and value2 is Multiply_Output (which is the sub-total multiplied by the tax decimal). The output result of this will be used as the final total, with the tax included.
  19. Select the End step and use the Show Editor button for Output, then add Total of the 'Decimal' data type. Map the Add_Results output as the input for the Total, which will then pass to the repeater. 
  20. Save and close this Flow once the logic is complete.
  21. Back in the Edit Data Flows window, select the Update Inputs button so that the data from the Flow will appear in this window to configure.
  22. Select the pencil icon next to SubTotal in the Flow Inputs box. When the window appears, choose Form Component from the Input Type dropdown list, then choose Form Data.SubTotal from the Form Data Name dropdown list.
  23. Select the pencil icon next to Tax. When the window appears, choose Form Component from the Input Type dropdown list, then choose Form Data.Tax from the Form Data Name dropdown list. 
  24. Select the pencil icon next to Form Data.Total in the Flow Outputs box. When the window appears, confirm that the Form Data name is Form Data.Total and leave the 'refresh components' box unchecked.
  25. The last configuration is under the Advanced section. Check the box for the EventButton Click so that the Data Flow will run when the button is selected. 
  26. Save and close both the Data Repeater and main Form.



Debugging

  1. Back in the Flow Designer, select the Debug button from the top Action bar. 
  2. Select the option to run a FULL debugger test. When the Form appears, enter a decimal for the tax amount to see that the data moves to the repeater in real-time.
  3. Select a line item in the repeater and use the Event Button to calculate the total, given the sub-total and tax. 
  4. Take a look at the debugger results to see that the Form was operating via the Data Flows to move the tax and calculate the total, the main Flow does not finish until the OK button is selected.



Project Download

Below is an attached zip file containing the build used in this example. This file can be downloaded and imported into a Decisions environment using our Import/Export Overview article.


Was this article helpful?