When using config data in Tray, it may sometimes be necessary for your use case to loop through an array of values associated with one config property. To do this, you’ll need to follow the below steps:
- Navigate to the meatballs menu (
), select Config data, and enter a property name.
- Click the pencil icon (
) to begin editing your property, and change the data type of the fieldfrom a string, represented by and A (
), to an array, represented by square brackets (
).
- Click Add to {{property_name}}, and another string field will appear. Change this field to an object, represented by a table icon (
). This is your first object in the array.
- Click Add to property 0 and enter a name. This is the first key in the object.
- In the string field below the property you just created, enter the value.
- You can continue adding properties (keys), or you can scroll slightly further down and add additional objects by clicking Add to {{property_name}} again and follow the steps above to create as many objects with as many key value pairs as needed.
- To loop through the objects in your config data, you will first change the List parameter in the Loop Connector to Jsonpath, and set the path to $.config.{{property_name}}. This will loop through each object you created.
Comments
0 comments
Please sign in to leave a comment.