Run a repeat loop to incrementally add to Datastore

I’m creating a multiple level BOM within a Knack program and I would like to be able to parse out all of the lowest level parts.
Each assembly has children of assemblies and parts.

The approach that I was going to take is to create a scenario where a filtered search would find Assembly records (“find assemblies within Assembly1”) and then add into a datastore, after the datastore is collected of all the assemblies, the scenario would Search for parts within the assemblies with a filtered search.

I can execute all these actions individually, but can’t create a repeat that has a changing variable.

Since there are multiple levels, I would need to run this as a loop changing the input to the “assembly search”. Search Assembly1 for assemblies yields Assembly 1.1 and Assembly 1.2. I would then need to change the Search input to Assembly 1.1 on the next loop. I was trying to do this by creating a variable (“PROD”) and changing it at the end of each repeat.

Is there any way to create a repeat loop where a variable can be updated based on a module’s output within the repeat?

Yes, within your repeater you can use Get Variable first to pull the last known value of your variable, and be sure to update the variable with a Set Variable before the end of the repeated section.