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.
Views
Replies
Total Likes
OP again. I think I found a way. After creating Data Store A, I added one row per each aisle (with just the Aisle number populated) in Data Store B, which allowed me to 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.
But if anyone knows of a more elegant way to go about concatenating these strings, I am all ears.
Views
Replies
Total Likes
oh this is an interesting one ...
So two Data Stores
And you want to combine the two values say from the ingredients column into one new food variable ... I guess it would look like this -
With a result like this ...
I think the issue here will be loops ... this will most likely not work when both data stores have more than one record ... just like you said, you need a way to associate each entry between each record in each datastore .. kind of like a foreign key I guess. This would matter in cases where one data store has 10 records and another has say 4. While I'm not sure what the use case, requirement, or vision is for this, this is how I started to think about it.
Views
Replies
Total Likes
Thank you so much for your ideas. Your solution is very similar to mine, albeit a little bit different because I am only combining "food" from Data Store A and using Data Store B to hold the concatenated strings.
I did manage to get the whole thing working after a few failed attempts to choose the correct iterator value (in my real data, I am looping through a collection that is nested within an array that comes from an API call). I always have trouble setting the iterator value, but eventually got it working.
I appreciate this forum!
Views
Replies
Total Likes