Using a query as a condition for an update query

Hi famousmag. Thanks so much for taking the time to reply and help. Ive already taken a lot from your first response :pray:

I have broken out your questions below and tried to answer them clearly. Please let me know if anything needs further detail.

A) Have you set a schema for provider_array? Show us...

No, on this occasion I am working on the basis that the schema will be taken from the first value provided. In a previous iteration I did specify the schema but have reverted.

B) In this setValue step I don't see a name... Is there a global name? Show us...

Yes, I have gotten a little confused about the naming of fields in relation to repeats. Apple kindly pointed me to the following article (Set value - Name and Global Name values discussion - #16 by Apple) which my take away was that I would use globals in the circumstances. See below I have named this one temp_prov_array.

image

Here, when using the [0], you always get the first records of query_providers provider_id.

OK, this was deliberate on this occasion as I was troubleshooting and wanted to remove a variable. I will now replace with the $index value as directed. Thank you

Is this what you want or maybe you should get the repeat's current provider_id by using the $index (query_providers[$index].provider_id)?

That’s interesting. I hadn’t understood the use of the $index value, I will use that going forward. You will see in the in the earlier repeat that works I have used the “outcode_count” var successfully to increment each repeat.

C) Here you use the temp_prov_array but I can't see that anywhere in your screenshot...

What is temp_prov_array?
See above. I have tried to use that array to hold the output of the query in the set value mentioned above.

Lastly, another point for awareness, I have currently hard set the query to remove a variable in testing too. As you will see I am hard setting the GU18 outcode only and have ran within the query builder and get 5 lines as I would expect. So there is good data there for the repeat to work from.

My end desired endstate would be this, where I am using the first array to query the provider table. However, I have simplified the query to aid the troubleshooting of the array>insert query element:

If you're still reading, thanks in advance :slight_smile: