Making a concatenated string from Fusion Data Store
Hi. I could use some fresh eyes on this...I'll make up a simple example to sketch out what I'm trying to do:
I have 2 data stores. I start each run of the Scenario by clearing both of the stores. As the Scenario progresses thru various API calls, the data starts to take on the following structures:
Data Store A looks like this (pretend that each area between hyphens is a column):
- Row 1 - Aisle 1 - eggs -
- Row 2 - Aisle 1 - cheese -
- Row 3 - Aisle 1 - butter -
- Row 4 - Aisle 2 - OJ -
- Row 5 - Aisle 2 - berries -
For Data Store B, I want a table where each row represents an aisle that will hold a concatenated string of the contents of that aisle:
- Row 1 - Aisle 1 - eggs & cheese & butter -
- Row 2 - Aisle 2 - OJ &. berries -
To build this string for Data Store B,, I wanted to loop thru each row in Data Store A, take the item in the row, add or append it to variable "x", then write "x" to the row for that aisle in Data Store B. e.g.
- Row 1 - Aisle 1 - eggs -
then for the item in that aisle in Data Store A, I first search for Aisle 1 in Data Store B, to see what's already in that aisle and if there's already a value I want to append rather than overwrite it.
- Row 1 - Aisle 1 - eggs & cheese -
And so on.
However, since I clear all data stores at the beginning of the scenario, every time I initially search Data Store B during each iteration to see if there is already a value in the concatenated string column that I can append to, since it's always initially empty, the iteration ends. I don't ever get the option to ever write "eggs" to the store because it never gets to that module.
I also seem to have to write each built-upon concatenated string to the data store rather than just store it in the variable temporarily because I don't seem to be able to reference the variable inside the same module where I'm setting the variable. For example, I can't say "If Variable A is empty, set Variable A to y"... because I can't reference the variable from inside the Set Variable module.
How do I best accomplish what I want to do? Sorry if this doesn't make sense, but I've been staring at this into the wee hours. Please feel free to ask me for clarifications.