I have a process that asks a user to input up to 10 potential values for an item on a form and I need to have those values put into a dateable to go through manipulation row by row.
For example, if the prompt is list your favorite cities, up to 10 entries, the result would be City1, City2, City3 etc. In the Argument dictionary, I tried assigning each key (City1, City2) as a string and setting the value as variable of the same name.
I want to avoid having 10 ‘Add Data Rows’ for each individual variable, there has to be a cleaner & quicker way to put them together and throw them into a table where each entry is its own row/line. I tried using an assign activity, saving all of the values to a variable that is string but that was failing.
Please help, I’ve been going in circles! The old form activity allowed the entries to be saved to a collection, which would be super helpful here.
- Initialize a Dictionary variable:
citiesDict = New Dictionary(Of String, String)()
For Each Activity:
- Iterate from 1 to 10.
- Inside the loop:
- Use an “Input Dialog” to get user input.
- If input is not empty, add to
Build DataTable Activity:
- Create a DataTable:
- Add columns: “CityNumber” (String), “CityName” (String).
For Each Activity (Second Loop):
- Iterate through
- Add each pair to
dtCities using “Add Data Row.”
dtCities contains user-input values with columns “CityNumber” and “CityName” for further manipulation.
Thanks & Cheers!!!
Step 1: Collect user input for favorite cities
Input Dialog: “Enter your favorite cities (separate with commas):”
Store the result in a variable called UserInput
Step 2: Split user input into individual city values
Assign: CityArray = UserInput.Split(","c)
Step 3: Create DataTable to store the cities
Build DataTable: CityDataTable
Add DataColumn: “CityName”
Step 4: Populate DataTable with city values
For Each: city in CityArray
Add DataRow: CityDataTable.Rows.Add(city.Trim())
now, CityDataTable contains each city as a separate row
Ideally there would be only one add datarow for all values together
If you use 10 separate it adds into different rows not same row