Changing a specific item within a list.
Comments
-
I have a list that I am trying to change an object in without changing the whole list. Is there a simple step that I can use to achieve this?
-
[b]note: These directions will only work for a list of defined datatypes(folder, accounts, entities, etc) they will not work for list of simple types(strings, ints, datetimes)[/b]
There is not a replace in list step, however what you are trying to do will depend on the datatype that you are using. For composite datatypes we can use a simple 2 step flow that will allow us to replace part of an object. Ive provided an example in this post.
In the Get Item By Index Step, we define the Original List as well the item index that we want change. I made this an input in the start step so that you could specify an index that may be different depending on what list is being passed in. This step will have an output of the specific item within that index, also remember that when dealing with lists, 0 is the first index and item within the list.
In the create data step, we make our object that we want to change within our list. It doesnt have any definable inputs or outputs in the properties panel except for the Edit Input/Output Mappings at the top. This is where were going to be making our changes.
The input mapping is going to be what we want to change the item selected to. Ive made this a constant in this example.
The output mapping is going to be set to Change Value and pointed at our List Item output from the Get Item Step. We want to point this to the specific item that we are trying to change. In the example I changed the description of an account from whatever it was to "This is an account"
In the output step there is an output of the same type as your initial type and the input is the original list that was used. This allows you to see the changes.
*Please Note: The examples attached were developed to be instructional, and were not developed as officially supported components. For more information or to engage our service team to develop fully supported, production quality solutions, please contact: services@decisions.com
[i]edited by Will@decisions.com on 1/14/2020[/i]
Howdy, Stranger!
Categories
- 4.1K All Categories
- 61 General
- 11 Training
- 201 Installation / Setup
- 1.1K Flows
- 106 Rules
- 260 Administration
- 212 Portal
- 489 General Q & A
- 693 Forms
- 333 Reports
- 3 Designer Extensions
- 47 Example Flows
- 51 CSS Examples
- 1 Diagram Tile
- 7 Javascript Controls
- 178 Pages
- 5 Process Mining
- New Features
- 178 Datastructures
- 69 Repository
- 219 Integrations
- 28 Multi-Tenant
- 27 SDK
- 76 Modules
- 56 Settings
- 25 Active Directory
- 12 Version 7
- 35 Version 8
- 66 Lunch And Learn Questions