Jump to content

Packing List - For lack of a better description.


Recommended Posts

Good Morning,


I have a template that creates a single pdf document from an order file.


Each "Order" has multiple records in a .csv file.


Each line of data contains the order number, persons name and address and the detail for the particular item ordered.


When the order number changes, page one of the resulting PDF is created with the persons name and address and some other bar code information.


Then the template creates subsequent pages based on the ordered pdf file name in each record for that order.


When the order number changes, it creates the next address sheet and the rest of the pdf pages for that order. And so on.


All of that works fine.


Now the client would like to include a listing on that first address page sort of like a packing list. It would list all of the "Items" that are part of that order.


The problem is that each item is in a different record.


Is there any way to accomplish this in Fusion Pro?


It would have to look at all the records for a particular order number and summarize them on the first page of the resulting pdf. And then create all the remaining pages of the pdf based on the records for that same order.


Any suggestions will be appreciated.


Thank you.

Link to comment
Share on other sites

Basically what you want to do is link to your primary data file as an external data file when you're creating the address page. This will give you visibility to all of the records in your data file. From there, you find all of the records that match the current records "Order" field value using the 'findRecords' method. The method returns an array of record numbers that have matching order numbers – i.e., record numbers for items in the current "order."


It's not really clear to me what you're trying to do with that information from there, but you can use the record number to access any of the other field values and format it however you'd like. In the example below, an array of record numbers which have the same value in the "Order" field as the current record is created and the values are mapped to the value of the item's "Detail" field:

var data = new ExternalDataFileEx(PrimaryInputFile(), FusionPro.inputFileDelimiter);
var order = data.FindRecords("Order", Field("Order"))
   .map(function(item) { 
       return data.GetFieldValue(item, "Detail");
return order;

Link to comment
Share on other sites

This kind of thing is what we historically refer to as a "table of contents" or "TOC" job. You can accomplish emitting such a table without iterating separately through the data, by using <crossref> and <destination> tags. This functionality has been available since the very early days of FusionPro and its predecessor DL Formatter, long before we had the external data file feature or even JavaScript rules.


More info in the Tags Reference Guide, as well as these threads:




Also, the table of contents aside, this sounds to me like a perfect use case for the new multi-line records feature in FusionPro 10.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...