Variable Cleanup in a loop

This issue has been solved. See solution.
matzebru's picture

I have two, integrated loops in one of my workflows (see image) that both contain a form to fill out. Each time through the loops, new data needs to be entered into the fields on the forms. The problem I have run into is when I loop through and then back to the form, it will pre-populate all the fields on the form with the data that has been entered on the prior pass though the loop. The only way I have found to solve this (so subsequent passes to the forms have no data from the prior pass) is to add a "RemoveDataComponent" (see image) for each field/variable downstream of the forms.

Does anyone have a suggestion on a better way of doing this? I'm sure it's probably something simple I'm missing. Thanks!

imagebrowser image

Rob Moore's picture

I can see 2 ways to do this...

Solution

The first is to use a single component called Initialize Data. This allows you to define multiple variables and set an emtpy value for all of them.

The other method, which is probably better in the long run, is to create a complex Variable type that has all the fields you need. With the complex type, you have a single varialbe, with multiple elements. When you want to clean out the variables, you just have to use one Remove Data component.

rob

matzebru's picture

Nice!

Thanks Rob! Sometimes I get too busy putting stuff together and my eyes glaze over the obvious stuff in Workflow :) I can see both of those solutions working nicely!