Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library


Thread Tools Search this Thread Display Modes
Old August 26th, 2013, 07:28 AM
rgreenidge rgreenidge is offline
Regular Contributor
Join Date: Sep 2008
Location: Toronto, Canada
Posts: 57
Exclamation External data Cross Reference and Output

I am trying to create a rule that Cross references to fields, if they match I want to output that record and it's repeat qty. I would also like to have a slipsheet between records, that prints some of the fields from the extrenal file ie: the Shipping day. So far I have tried to use the following for the External data part from the example file you posted, but it does not seem to be linking to the external data. I am sure there maybe parts that are not needed to want I am trying to accomplish

Placed in OnJobStart Rule:
//Link to the external data file.
//The '\t' is used to indicate TAB delimited data in this external data file
externalDF = new ExternalDataFileEx('Fri Kit 36.txt', '\t');

if(externalDF.valid != true)
Print('Failed to link to the external data file in OnJobStart');

Separate Rule Created:

//Create an empty variable that will be populated with a
//string of text that lists the customer's purchases
returnStr = '';

//The following if statement will detect if we are currently in preview
//mode or editing this rule (versus composing output). If so, the script
//will manually call the OnJobStart rule so the link to the external
//data file can be established. OnJobStart is called automatically when
//a full composition is run.
if(FusionPro.Composition.isPreview == true || FusionPro.inValidation == true)

//Get a count of the total number of records in the external data file
numRecsExtDF = externalDF.recordCount;

//Now, loop through all records in the external data file and
//find the records that belong to the customer. This is done
//by comparing the value of "CustomerID" from the main input
//data file to the value of the "CID" field in the external data
//Note that in this example, there can be multiple records in the
//external data file for each customer which is why we are going to
//look at every record in the external data file.

for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++)
//Compare the value of the CID field in the current record
//we are looking at in the external data file to the value
//of the CustomerID field in the main data file.
if (externalDF.GetFieldValue(recordWalker, 'Store_Num') == Field("Store_Num"))
//Check to see Ship Day. If it is, let's format it differently
if (externalDF.GetFieldValue(recordWalker, 'day') == 'Friday')
returnStr += 'Store_Num' + externalDF.GetFieldValue(recordWalker, 'Store') + '</b>';

else //OK - so this is a normal product - not a Tax item

return returnStr;

Thanks in advance.
FusionPro Products Desktop
FusionPro VDP software version: 8.2.7
OS:Macintosh OS X 10.6.8
Acrobat Version:Acrobat 9.x
Location:Toronto, Canada
Reply With Quote
Old August 27th, 2013, 09:54 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,462
Default Re: External data Cross Reference and Output

Originally Posted by rgreenidge View Post
So far I have tried to use the following for the External data part from the example file you posted, but it does not seem to be linking to the external data. I am sure there maybe parts that are not needed to want I am trying to accomplish
It's hard to know what's going on without more information. What exactly do you mean by, "it does not seem to be linking to the external data?" Do you get an error message? Is it getting the wrong data? Is it not getting any data at all? If you could post the external data file, or better yet, the whole template, or at least enough of it to show the issue, that would be helpful.
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 06:30 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.