My input data file is a batch PDF file (as per attached sample). It is a mail-merge letter and I would need to extract the Mailing Addresses which fall under <c.c.> sections (under the paragraph of “This letter is computer generated; no signature is required.”), so that I able to perform grouping and sorting according to the 1st <c.c.> Mailing Address and also the 2nd <c.c.> Mailing Address.
I’m facing issue when trying to extract the 1st <c.c.> Mailing Address as field A, then extract the 2nd <c.c.> Mailing Address as field B.
Appreciate if anyone can help to enlighten me. Thank You so much.
In a nutshell, it uses the Goto step, specifying Next occurrence of as the Target type. The expression to look for is "c.c. : ". It also specifies to look for that expression in a narrow column on the left hand side of the page, instead of the entire page width.
Then it extracts the first field.
Finally, it duplicates both steps to extract the second field.
My colleague @hamelj quite rightly noticed that my solution doesn’t work if the height of the addresses vary on each record.
So I adjusted the DM config to take that into account.
After the first Goto, it no longer extracts anything. It simply records the current vertical position to a variable.
Then, it does the second Goto, and from there, it first extracts up (using a negative vertical offset that’s the difference between the current vertical position and the one recorded in the variable). And then it extracts the second address as before.
I had already described this technique elsewhere on these forums to extract item descriptions of varying heights in detail tables.
[0022] W3001 : Error while executing plugin: HTTP/1.1 500 An unspecified error occurred which was caused by LoggedApplicationException: There was an error running the data mapping process caused by ApplicationException: Error executing DM configuration: Error running script (TypeError: Cannot read property “length” from undefined) (DME000019) (DM1000031) (SRV000012) (SRV000001)
I tested it here, after having modified @hamelj’s template, and everything works as expected. I ran the template both in the DataMapper itself and from Workflow.
So there’s probably something else in your DM that’s causing the issue.
The DM is working fine. The issue I facing on Workflow was due to I used the wrong input data file (which the second c.c. do not have the label of c.c.).
Sorry for the confusion and Thank You so much for your help.