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

Question

Question

Forms collection values repeating themselves

asked on December 3, 2019 Show version history

I have a form with a collection on it of 4 fields. I allow up to a maximum of up to 4 individual collections on the form. I am passing the form to a workflow where I "Retrieve Business Process Variables" for the purpose of passing that data to a "Fill out PDF Form" activity. 

After entering the values on the form and letting the workflow create the PDF, the values populated on the PDF 'start over' (See attached). In the Name field (On the PDF) there is a place for a name up to 4 times. If I only enter in 3 names on the LF form, the fourth name is still added to the PDF form and starts over as 1. 

In the above instance, I only added "Anthony 1", "Anthony 2" and "Anthony 3". Here is a screen of my workflow:

In the "Fill Out PDF fields" activity I am using this for each of the fields on the PDF %(RetrieveBusinessProcessVariables_Defendants\DefendantName#[1]#), incrementing the index for each of the fields. If the person filling out the LF form only enters 1 name I want only one name copied to the PDF. I am not sure why the index restarts OR why the value gets written to the last index. 

 

****EDIT I figured this out and this is much simpler than my original attempt. If I bring in the collection of fields from the "retrieve business..." activity and use the TABLE tab in the "Fill PDF..." activity there's no need to loop through tokens, or worry about them in any way. All you need to do is reference the fields in the PDF through regex and assign the values to the collection (no need for indexes). 

 

0 0

Replies

replied on December 3, 2019

Slowly getting somewhere...it appears what I am trying to do (this way) is not possible

Note: If you are counting values from the top down and you specify an index greater than the total number of values in the token, the token will be replaced by the last value

To review, I have a LF form that allows you to enter up to 4 sets of data in a collection. I am copying that information to a PDF that is hard coded with 4 fields for the data (represented in the collection). The user can enter between 1 and 4 sets of the information.

The issue is, as represented in italics above, is that when the index requested goes beyond the number of indexes in the token, the information displayed will be the from the last index. If I only fill 2 indexes on the LF form, and try to write 4 indexes to the PDF, I will get index 1, index 2, index 2, index 2. I don't want the data if it was not entered (index 3 and 4 should be omitted from the PDF). 

0 0
replied on December 4, 2019

Hi Anthony

Because of the normal behavior you mention above, a work around might be to read the values from the table into a Multi-value Token first where you can massage the data before applying it to the PDF.

You could test for how many rows of data exist in a table and then built a loop to assign the actual fields to the Token, and then another loop to account for the required empty fields.

0 0
replied on December 4, 2019

Thanks, Steve. 

I think no matter what, I will have to test the array first for the number of indexes.

I have two pdfs that need to be filled that have 4 collections on them and two pdfs that need to be filled with up to 12 collections on them. It sounds like I will have to statically create 4 multi-value and 12 multi-value tokens, respectively. Then test the incoming data to see how many indexes are in the array. Then run a conditional decision testing for the number of indexes in the incoming data and write to the tokens with hard-coded branches (in the case of 4 collections, hard coding 4 branches for the up to 4 indexes of the array). 

As another level of complexity, I wonder if I can programatically reference a token that gets nested in a "For...Each" row loop? E.g. have tokens named Token1, Token2, Token3, etc... and on each ForEach loop programatically refer to the tokens (so I wont have to hard code 4 or 12 branches). 

0 0
replied on December 4, 2019 Show version history

Hi Anthony, yes, Look at For Loop  Iteration. Basically this is the counter that indicates what cycle the loop is on. (ie: 1, 2, 3), I would look at this before getting into creating branches.

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

Sign in to reply to this post.