Jump to content

Return multiple lines from XDF


andym

Recommended Posts

Hi All,

 

A client of ours presented something I've never dealt with. They are doing a series of letters, with variable data in the center of the page. The spreadsheet they sent is sorted by STORE ADDRESS and by MAILING ADDRESS.

 

There are multiple rows of unique STORE ADDRESSES that share the same MAILING ADDRESS. It looks like these letters are going to store owners. If stores share the same owner (Mailing Address) we need to list all the corresponding STORES tied to that address in a list. I've attached a sample letter.

 

The lines highlighted in yellow show the variable STORE text. This can range from 1-30 stores.

 

First question: How do I write a script to pull as few as 1 or as many as 30 lines and return them on separate lines of the same letter?

 

Second question: Some of the larger versions of this letter will flow to a second page. If I have a text box over flow, how do I suppress empty pages when they all fit on one page?

 

I'd be happy to share more information if it helps show what we need. Thanks in advance for reading through this.

 

Andy

Sample.jpg.fa8a50993d5c05f59aa5b379ccc26fee.jpg

Link to comment
Share on other sites

store location:

1. you can create a rule returning the results from external table lookup scripting for the store address that matches mailing address key (id, etc)....or

2. if pre-doing the store addresses prior to fusion pro (location1+<br>+location2+<br>....etc into a field) you can create a rule to return the field checking "treat return strings as tagged text"....

 

overflow portion:

1. you can create/insert overflow page in fusionpro so when a textbox overlow flows it uses the overflow page's text boxes that you've designated for the overflow flowed text.

Edited by tou
Link to comment
Share on other sites

First question: How do I write a script to pull as few as 1 or as many as 30 lines and return them on separate lines of the same letter?

 

What version of FusionPro are you using? I believe FusionPro 10 has functionality that does exactly what you're describing.

 

That being said, if you're using an older version (version 9 for example – because it's what I'm using), you'll need to link to your primary data file as an external data file. Then you'll want to query the data file for all records that have the same "MAILING ADDRESS" value. You'll probably want to make sure you don't compose those records again once its "STORE ADDRESS" has been associated with a mailing address so you don't end up with duplicates. You can do this by using a global variable to track which mailing addresses have been used.

 

JavaScript Globals

processed = [];

 

OnRecordStart

FusionPro.Composition.composeThisRecord = processed.indexOf(Field("MAILING ADDRESS")) == -1;

 

Text Rule

processed.push(Field("MAILING ADDRESS"));
var data = new ExternalDataFileEx(PrimaryInputFile(), ',');
return data
 .FindRecords('MAILING ADDRESS', Field('MAILING ADDRESS'))
 .map(function(rec){
   return data.GetFieldValue(rec, 'STORE ADDRESS');
 })
 .filter(String)
 .join('<br>');

 

Second question: Some of the larger versions of this letter will flow to a second page. If I have a text box over flow, how do I suppress empty pages when they all fit on one page?

FusionPro > Manage Pages > Page Usage

Select the page to which you want to over flow, click edit, and change its type to "Overflow" and click "OK"

Select the text box you want to overflow

Select "Overflow" from the "text frame" properties window

Select "Overflow text to new pages"

Select the overflow page you just created in the "Page Usage" section

Selecting "as few added pages as possible" in the option list under "Add pages" will give you your desired results.

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.

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