Mixed Type Repeater
  • 20 May 2022
  • 6 Minutes to read
  • Dark
    Light

Mixed Type Repeater

  • Dark
    Light

Article Summary

Overview

The Mixed Type Repeater control allows a Decisions Form to dynamically display which type of repeater to display based on a user's input. Users can also display different custom data types or primitive data types. A common use case for the Mixed Type repeater is for creating dynamic surveys. When creating a survey, users can use the mixed type repeater to populate different types of survey questions like a radio button list, true or false question, or multiple-choice question. 

Example

In this example, a Form will give the user the ability to create a custom dropdown list repeater with a label or a text data repeater with a label. Both repeaters will have the ability to be instantiated by the click of a button. There is also an add to list event that will be is used to add elements to the drop-down lists.

Relevant Example Lab to Follow

An example lab project about creating a mixed type data repeater is available to follow alongside this article. An example lab offers the reader a downloadable Decisions file available for importing into the reader's own Decisions instance alongside a thorough an explanation of its configuration. After importing the file, the reader may examine the functional project at their own pace from within the platform.

Please refer to our Creating a Mixed Type Data Repeater Example Lab to review, download, and import the project.


  1. In the Designer Project, click CREATE DATAYPES/INTEGRATION on the Global Action Bar and select Defined Data Structure.
  2. Enter "Text_Element" in the Structure Type Name field. Configure the Structure to have two String data members (Data, Name) and click SAVE.
  3. Create a second Defined Data Structure with the Structure Type Name as "Dropdown_Element" and three String data members (List, Data, Name). Click the Is List checkbox next to the List data member. Then, click SAVE.


  4. Create a third and final Defined Data Structure, type "Element" in the Structure Type Name field. Configure the Structure to have two String data members (Data, Name) and click SAVE.
  5. Click CREATE FLOW from the Global Action Bar and select Flow. Name the Flow (Main Flow) and select CREATE.
  6. Click the Done path on the Start step. Select the Show Form step and click ADD.
  7. With the Form step selected, click PICK OR CREATE FORM and select CREATE.
  8. On the Create New dialog window, select Form and name the Form. Then, select CREATE.
  9. Configure the Form to have the following controls and Data Names:
    Form ControlLocation in ToolboxData Name
    ButtonActionsButton
    Text BoxDataName
    Event ButtonActions > EventsEventButton_Text
    Event ButtonActions > EventsEventButton_Dropdown
    Text BoxDataAddToList
    Event ButtonActions > EventsEventButton_Add_List
    List BoxDataList
    Mixed Type RepeaterUser ControlsElements


  10. Select the Mixed Type Repeater Control. In the Data Name text box under COMMON PROPERTIES, type "Elements".
  11. Click ADD NEW under Sources and select PICK SOURCE. On the dialog window, select CREATE and click User Defined Control. Enter a name (Dropdown User Control List) and click CREATE.
  12. When the Form Designer opens, select SETUP INPUT DATA.
    1. In the Name field enter "Dropdown_Element". Click the Type field dropdown list and navigate to User Defined Types > Defined Data Structures and select Dropdown_Element.
    2. Click Save and then close the window.
  13. On the Data panel, expand DROPDOWN_ELEMENT. Click and drag the Name field to the Form and select Label Of Data Value on the pop-up menu. Then, press Enter to save control.
  14. In the Toolbox panel, drag and drop a Drop Down List control to the Form under the Label. 
  15. Under the INPUT DATA category on the Properties panel, click the Type dropdown list and select String [Text]. Expand the List Input Source dropdown and select DataName.
  16. Under List Items DataName field click PICK FROM DATA. Expand Dropdown_Element and select List. Then, click PICK.
  17. Save and close Form Designer. Then, select OK on the Add Sources dialog window.

  18. Back in the Form Designer, select the Mixed Type Repeater Control again. 
  19. Click ADD NEW under Sources and select PICK SOURCE. On the dialog window, select CREATE and click User Defined Control. Enter a name (Text User Control List) and click CREATE.
  20. When the Form Designer opens, select SETUP INPUT DATA.
    1. In the Name field enter "Element". Click the Type field dropdown list and navigate to User Defined Types > Defined Data Structures and select Element.
    2. Click Save and then close the window.
  21. On the Data panel, expand ELEMENT. Click and drag the Name field to the Form and select Label Of Data Value on the pop-up menu. Then, press Enter to save control.
  22. In the Toolbox panel, drag and drop a Text Box control to the Form under the Label
  23. Under the COMMON PROPERTIES category on the Properties panel, under Data Name, select PICK FROM DATA. Expand Element and select Data. Then, click PICK.
  24. Click Save and close Form Designer. Then, click OK on the Add Sources dialog window.
  25. Select SETUP INPUT DATA on the Form, add Elements (Object-List), Name (String), List (String-List), Item (String).

  1. Click the workspace around the Form. In the Properties panel, scroll down to the FORM RULES > Active Form Flows, select ADD NEW.
  2.  Name the Flow "Add Drop Down Element" and Select EDIT RULE FLOW.


  3. On the outcome path of the Start step, add a Create Data step. 
  4. In the properties of the Create Data step navigate to DATA > Data to Create, select Show Editor.
  5. Name this DropdownItem with the data type Dropdown_Element.
  6. On the Create Data step Inputs, choose Build Data as the mapping type. 
  7. For List, select Form Input Data > List. For Name, select Form Input Data > Name.


  8. On the outcome path of the Create Data step, add a Set Control Value step. 
  9. In the Set Control Value step Properties, navigate to Inputs, select Form Data > User Control List Container for the Form Control
  10. Under Elements, select Join Arrays as the mapping type. 
  11. For Item 0 select Form Input Data > Elements, for Item 1 select Build Array as the mapping type, then for Item 0 choose DropdownItem.

  12. Save and close the Flow. Back in the Edit Active Form Flows dialog, under ADVANCED > Triggers, choose EventButton_Dropdown: Click.
  13. Select OK to save.

Text Element Active Form Flow

  1. Click the workspace around the Form. In the Properties panel, scroll down to the FORM RULES > Active Form Flows, select ADD NEW.
  2. Name the Flow "Add Text Element" and Select EDIT RULE FLOW 1.

  3. On the outcome path of the Start step, add a Create Data step. 
  4. In the properties of the Create Data step navigate to DATA > Data to Create, select Show Editor.
  5. Name this TextElement with the data type Text_Element.
  6. On the Create Data step Inputs, choose Build Data as the mapping type. 
  7. For Name, select Form Input Data > Name.

  8. On the outcome path of the Create Data step, add a Set Control Value step. 
  9. In the Set Control Value step Properties, navigate to Inputs, select Form Data > User Control List Container for the Form Control
  10. Under Elements, select Join Arrays as the mapping type. 
  11. For Item 0 select Form Input Data > Elements, for Item 1 select Build Array as the mapping type, then for Item 0 choose TextElement.


  12. Save and close the Flow. Back in the Edit Active Form Flows dialog, under ADVANCED > Triggers, choose EventButton_Text: Click.
  13. Select OK to save.

Add to List Active Form Flow

  1. Click the workspace around the Form. In the Properties panel, scroll down to the FORM RULES > Active Form Flows, select ADD NEW.
  2. Name the Flow "Add to List" and Select EDIT RULE FLOW 2.


  3. On the outcome path of the Start step, add an Add Item to List step. 
  4. In the properties of the Add Item to List step, navigate to Inputs, under New Item choose Select From Flow as the mapping type and select Form Data > Add to List Text Box > Value
  5. For Original List select Form Input Data >List from the Select from Flow option
  6. Under Outputs, change the value of New List to Form Input Data > List


  7. On the outcome path of the Add Item to List step, add a Set Control Value step. 
  8. In the Set Control Value step Properties, navigate to Inputs, select Form Data > Simple List for the Form Control
  9. Under Item Source, select Form Input Data > List.


  10. Save and close the Flow. Back in the Edit Active Form Flows dialog, under ADVANCED > Triggers, choose EventButton_Text: Click.
  11. Select OK to save.

Debug

  1. Back in the Main Flow connect the Show Form step to the End step.
  2. Select Debug and verify that the Flow works properly.

Was this article helpful?