Add Item/Items to List
- 27 Mar 2023
- 1 Minute to read
- Print
- DarkLight
Add Item/Items to List
- Updated on 27 Mar 2023
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Step Details | |
Introduced in Version | 4.0.0 |
Last Modified in Version | 8.8.71075 |
Location | Data > Text |
The Add Item to List step adds an item to a list if it is the same datatype with an index starting from zero. The step requires both the input item and the list item to be the same datatype; otherwise, an error will be thrown.
Properties
Data
Property | Description | Data Type |
---|---|---|
AddToListPosition | The position where the new item will be added. The new item can be added at the start, end, or at a specified index. | --- |
ListType | The datatype for the added list. | --- |
Inputs
Property | Description | Data Type |
---|---|---|
Index | Available if AddAtIndex is selected for the AddToListPosition Property | Int32 |
New Item | The item to be inserted into the list. The item must match the datatype of the list, otherwise an error will be thrown. | Varies, dependent on the ListType Property |
Original List | The list that the new item will be added to. | Varies, dependent on the ListType Property |
Outputs
Property | Description | Data Type |
---|---|---|
New List | TA list which contains the newly added item | Varies, dependent on the ListType Property. |
Example Inputs and Outputs
New Item | AddToList Position | Original List | Output |
---|---|---|---|
Hello World | AddToBegining | {"FirstItem", "SecondItem", "ThirdItem"} | {"Hello, World", "FirstItem", "SecondItem", "ThirdItem"} |
Hello World | AddAtIndex, 5 | {"FirstItem", "SecondItem", "ThirdItem"} | EXCEPTION MESSAGE |
Hello World | AddToEnd | {"FirstItem", "SecondItem", "ThirdItem"} | {"FirstItem", "SecondItem", "ThirdItem" Hello, World"} |
Common Errors
Source array was not long enough. Check the source index, length and the array's lower bounds.
This error appears if the array's length is less than the value used for the Index. The step will throw the following error. Ensure that the value for the index is less than or equal to the size of the array.
Exception Message:
Exception Message: Error running step Add Item to List Step 1[AddItemToListStep] in flow [Example Flow]: Source array was not long enough. Check the source index, length, and the array's lower bounds. (Parameter 'sourceArray')
Input Values:
-- No Data --
Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Add Item to List Step 1[AddItemToListStep] in flow [Example Flow]: Source array was not long enough. Check the source index, length, and the array's lower bounds. (Parameter 'sourceArray') ---> System.ArgumentException: Source array was not long enough. Check the source index, length, and the array's lower bounds. (Parameter 'sourceArray')
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
at DecisionsFramework.Design.Flow.CoreSteps.AddItemToListStep.Run(StepStartData data)
at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData)
at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData)
--- End of inner exception stack trace ---
Was this article helpful?