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

Question

Question

For Each Value only pulling first value

asked on February 6, 2018

I'm attempting to fill in a PDF form based on multi-value fields and I'm running into an issue where, within the For Each Value activity, filling the PDF form only pulls in the first value's info (e.g. for 2 records in MV field, I get two PDF sections filled, but with data from only the first value).

For each value in DOB field, I want to fill in the PDF fields with the corresponding record's metadata. I'm using the Current Value token when filling in the DOB field and using the "#[%(ForEachValue_Iteration)]#" on all other fields in the Fill PDF Activity. the only activity I have within the For Each Value activity is Fill PDF.

 

 

0 0

Answer

SELECTED ANSWER
replied on February 8, 2018

Ok I think I got it working. Take the PDF fill out of the For each value loop.  I am making the assumption that you are only filling out 1 form but you did the loop because the form has multiple names.  Because the metadata is already in multiple value tokens, using the table in the PDF fill will do it all at once without needing the loop.

I get the "does not contain a valid index" warning but in my example I only have 2 blocks being filled but I have 3 blocks on the PDF.  So the 3rd block receives the message that there is no index.

PDFFILL.jpg
PDFFILLWK.jpg
PDFFILL.jpg (37 KB)
PDFFILLWK.jpg (7.61 KB)
1 0

Replies

replied on February 6, 2018

Can you show the PDF you're trying to fill? For Each Value is likely to overwrite the PDF every time. You probably want to use the table feature in Fill PDF activity instead.

0 0
replied on February 6, 2018

I attached the PDF. I'll try the table feature out!

0 0
replied on February 6, 2018

I just tried this out, and now I've gotten an "Object reference not set to an instance of an object" error on the Fill PDF activity. 

0 0
replied on February 6, 2018

First, have you verified that the fields in your PDF are named differently?  For example the First Name fields are something like FirstName1, FirstName2, FirstName3; and not all FirstName.

 

Can you post a shot of your workflow For Each activity and your Fill PDF activity showing what you are using to fill in the fields?

0 0
replied on February 7, 2018

I updated the PDF so that each field name is different and updated the workflow, but still get the "Object reference not set to an instance of an object" error on the Fill PDF activity.

 

20180207_TAP_FillPDF.jpg
0 0
replied on February 7, 2018

What value are you using for your For Each Value loop?  Are you using a field or token that has more than 1 value?  If it only has one value, it would only do 1 iteration and therefore each field would be filled with only the first values.

 

 

0 0
replied on February 7, 2018

It's one that has more than one value. I'm using a Date of Birth field. Aside from the Address information, all other fields are MV and the example document I'm testing has info for 2 people.

0 0
replied on February 7, 2018

As far as the object reference error, if you changed the names of the fields did you put the new PDF in the Workflow Admin Console?  And did you refresh the fields on the PDF activity?

0 0
replied on February 7, 2018

I updated the PDF from within WF, but I understand that to be the same as doing it in the Admin console and I updated the PDF within the repository as well , and I refreshed the fields in the PDF activity. 

0 0
replied on February 8, 2018

So I found one field that wasn't getting data populated, which was causing the error for object reference. I don't know why the Retrieve Values isn't picking up the filled in template field, but for now I've resolved the object reference error.

In updating a few things, the Fill PDF table now gives me errors for all fields like this one, "Pattern for group " applied to field 'Eligibility Proof_2' resulted in the value 'Eligibility Proof' which dose not contain a valid index." I'm not entirely sure what this means. I added a Retrieve Values before the Fill PDF activity within the For Each Value activity group. I have the current value iteration as the Index on all of my field groups (e.g. %(RetrieveFieldValues_Eligibility Proof_All#[%(ForEachValue_Iteration)]#)). 

0 0
SELECTED ANSWER
replied on February 8, 2018

Ok I think I got it working. Take the PDF fill out of the For each value loop.  I am making the assumption that you are only filling out 1 form but you did the loop because the form has multiple names.  Because the metadata is already in multiple value tokens, using the table in the PDF fill will do it all at once without needing the loop.

I get the "does not contain a valid index" warning but in my example I only have 2 blocks being filled but I have 3 blocks on the PDF.  So the 3rd block receives the message that there is no index.

PDFFILL.jpg
PDFFILLWK.jpg
PDFFILL.jpg (37 KB)
PDFFILLWK.jpg (7.61 KB)
1 0
replied on February 8, 2018

Wow, thank you! That all works now smiley

0 0
replied on February 8, 2018

Great!  So glad we got it working.

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

Sign in to reply to this post.