Jump to content

Add Up Points From External Data

Recommended Posts

I know this is going to be simple for someone out there. I have only used external data once.


I have an external data file that contains order number, item ordered, and a point value for that item.


In my Fusion template I have a data file that contains the order number, shipping address, etc.


I need to go out to the external file and get all the point values for the items ordered for that same order number and add them up. This total point value will become part of the output file name of the PDF.


Ex: 40_THK1376.pdf (the 40_ is the total point value of the order and the rest of the file name is the order number itself)


Thank you for your help.

Link to comment
Share on other sites

Something like this:

var total = 0;
var XDF = new ExternalDataFileEx("orders.txt");
var items = XDF.FindRecords("Order Number", Field("Order Number"));
for (var i in items)
   total += Int(XDF.GetFieldValue(items[i], "Point Value"));
FusionPro.Composition.OpenNewOutputFile(total + "_" + Field("Order Number") + "." + FusionPro.Composition.outputFormatExtension);

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...