◷ Reading Time: 5 minutes
When a project rule project is loaded, simply go to the tools menu and select “Data Composer” as shown below.
The data composer window will appear as follows.
- Open: browse for previously saved data (using Data Composer) and reload it for use or modification.
- Remove all items from list: Clears the list of added objects
- Add an empty collection as data: Allows adding a new object of a specific type
- Duplicate selected data: Creates a duplicate of the selected object in the list
- Remove selected data: Deletes a selected object from the list
- Move up selected parameter: Changing the order of objects in the list, moving up
- Move down selected parameter: Changing the order of objects in the list, moving down
- Save as: Saves the prepared data for a file that can be used later on
- Watch the result: Evaluates, loads, then shows the constructed objects to the Watch window
Data Composer allows you to create a collection (Array) of objects.
With Data Composer you can
- Prepare some data (Simple and complex)
- Associated them with a Parameter name
- Manage pre-defined data for different scenarios (i.e., Test, Debugging, etc.)
Data Composer Form
Its form contains the main section
- Data list (left side)
- Object information (right side)
When a new object is created, it will be listed on the left-hand side panel. The details of the object will be listed in the right-hand side panel.
Adding New Object
To add a new object, you can simply click add icon and an empty item will be added to the list.
By filling in the type value on the right screen, you can create some simple values (e.g., string, integer, etc.) Here is the list of simple types:
For example, when you enter ‘System.String’ in the ‘type’ field, then you can extend the ‘Value’ node as shown below:
Complex types are the ones that are not defined by default like simple types, and you need to provide an assembly (a .dll) and select a type from a list. A complex new object needs a type and assembly (enter the type information). Please note that the assembly should be referenced in your project. If it is not, go to the “Project->Properties” menu and then select “References” and add your assembly. It is a good practice to keep all the assemblies local to your project folder. Once the type and assemblies are added, you will see the following screen:
Then you can simply expand the “Value” node. An empty type is then created for you to add the properties values:
You can provide JSON values for the parameters.
Once that is added, then you can create your JSON using the editor:
Adding a new Collection of Objects
When you click on the add button, there are two types of the list available:
- An empty generic list called Object List. This empty list cannot be modified at design time.
- A dynamic list that you can use Data composer to add more elements to it
If you select the Dynamic List and select the item from the left-hand side panel, then you will see the image shown below.
If you click on the button that the red arrow shows, then a new Data composer window will be launched. Now you can create the elements of the selected list from the previous Data composer screen.
Sample Data file
A sample Data input file (sample-data.zip) is attached at the end of the page.