You are viewing limited content. For full access, please sign in.

Question

Question

How do I clear out the values in a multi-value custom token?

asked on September 3, 2015

I have a workflow in which I'm creating some tokens at the beginning. These tokens are assigned a value at the start of a For Each loop, but I need to clear them at the end of the loop so that I can assign some fresh values during the next iteration. How do I do this?

I only see "append values" and "replace values" in the token dialog. I also need a "clear values" option like we have in the Assign Field values activity's dialog.

I also looked for a way to delete the tokens and recreate them, but couldn't find a way to do that either.

0 0

Answer

SELECTED ANSWER
replied on September 4, 2015

I think Winston was asking for the entire flow because it sounded like you had nested loops. The easiest way to handle that would be with a helper token that you create in the inner loop so it starts off clean at each iteration, then append to the main one at the end of the iteration.

0 0

Replies

replied on September 4, 2015

If the values are specific names not used elsewhere, you can use the "remove" function.

 

If you keep a 2nd token updated with a list of the index position of the starting tokens, you can use "remove at" to remove that index location from the first token.   


 

1 0
replied on September 4, 2015 Show version history

Hi Chris,

I tried that already, and it works during the first two iterations, but then starts to fail.

The scenario is as follows: property managers visit multiple properties a day and submit a "property visit form" from each property. At the end of the day, a workflow will run and send a daily report to each property manager summarizing the work they have done that day. 

Here's the part of the workflow that has the issue:

The final output will go into an email body and have this format for each property manager:

Submitter: Property Manager's Name
Job number: 1
Job name: test1

Submitter: Property Manager's Name
Job number: 2
Job name: test2

Submitter: Property Manager's Name
Job number: 3
Job name: test 3

I'm testing this workflow on a batch of six forms. Bob has one form (and one job name/job number), Denise has two, and Jack has three.

Below is the first email sent:

Submitter: Bob
Job Number: 1
Job Name: test1

THIS IS OK

Second email:

Submitter: Denise
Job number: 2
Job name: test2

Submitter: Denise
Job number: 3
Job name: test3

THIS IS OK TOO

But then Jack gets this email:

Submitter: Denise
Job number: 2
Job name: test2

Submitter: Jack
Job number: 3
Job name: test3

Submitter: Jack
Job number: 5
Job name: test5

Submitter: Jack
Job number: 6
Job name: test6

Submitter: Jack
Job number: 6
Job name: test6

This email has not only the wrong number of jobs (should be three instead of five), but also has Denise's job info as the first group. Then in the second group, the submitter changes to Jack, but job number and job name are still Denise's.

It's almost as if the internal For Loops go out of sync with the external loop after the first few iterations.

0 0
replied on September 3, 2015 Show version history

Hello Ege, 

 

One way to clear the tokens is to use the "replace values" option, but leave the "New values" blank. This will replace all the current values with a blank token, which is functionally similar to clearing the token values. 

Hope this helps!

0 0
replied on September 3, 2015

No, that doesn't work. An actual blank value is assigned to the first position in the token, so when the next iteration of the loop starts, the new values are appended to that blank value, so it looks like this:

Position 1: Blank

Position 2: New Value 1

Position 3: New Value 2

etc.

0 0
replied on September 3, 2015 Show version history

Hello Ege, 

 

Oh ok, since there is an assign token values at the start of the For Each Loop, you can set that one to be "replace values" instead of "append values" and that will overwrite the values from the previous iteration.

0 0
replied on September 3, 2015

That won't work either because that assign token values activity itself is inside a for each loop so it needs to append the values. If I set it to replace values it will overwrite in each iteration and I will end up with one value (the last one).

Now, if there was a way to say "replace first value, append the rest" that would work. :)

0 0
replied on September 3, 2015

Hello Ege, 

 

Would I be able to get a screenshot of the workflow to get a better understanding of the setup? Make sure personal information is not shown.

I do have a a solution in mind, but I want to make sure it will work with your setup.

0 0
replied on September 4, 2015

See my response to Chris for the screenshot.

0 0
replied on September 4, 2015

Hello Ege, 

 

For more information, would I also be able to see how the "Append retrieved job number and job name to MV token" and "Create final output" activities are set up? 

0 0
replied on September 4, 2015

0 0
SELECTED ANSWER
replied on September 4, 2015

I think Winston was asking for the entire flow because it sounded like you had nested loops. The easiest way to handle that would be with a helper token that you create in the inner loop so it starts off clean at each iteration, then append to the main one at the end of the iteration.

0 0
replied on September 4, 2015

Thanks Miruna. Do you mean attach the workflow here? I've attached Forms business processes before but they were removed by Laserfiche staff, which is why I've been posting just screenshots. If it's OK to attach .wfx files I can do that.

Anyway, I actually just resolved the issue by moving everything inside the main loop into its own workflow and invoking that inside the loop, so each instance creates its own fresh tokens and I don't have to worry about cleaning them up. But I guess the idea is the same. smiley

0 0
replied on September 4, 2015

Hello Ege, 

 

Miruna is correct that a helper token would work and based on the workflow screenshots that were given. Would this setup work in your case?

This would create the job number and job name tokens each time the loop begins since those are the ones that get overwritten each iteration. Each time they are created, they will start off clean.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.