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

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 19th, 2016, 03:20 PM
andym andym is offline
Junior Community Member
 
Join Date: Feb 2013
Posts: 21
Default Return multiple lines from XDF

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
Attached Images
File Type: jpg Sample.jpg (148.4 KB, 20 views)
Reply With Quote
  #2  
Old December 19th, 2016, 04:05 PM
tou tou is offline
Regular Contributor
 
Join Date: Oct 2015
Posts: 107
Default Re: Return multiple lines from XDF

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.

Last edited by tou; December 19th, 2016 at 04:10 PM..
Reply With Quote
  #3  
Old December 19th, 2016, 04:22 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: Return multiple lines from XDF

Quote:
Originally Posted by andym View Post
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
Code:
processed = [];
OnRecordStart
Code:
FusionPro.Composition.composeThisRecord = processed.indexOf(Field("MAILING ADDRESS")) == -1;
Text Rule
Code:
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>');
Quote:
Originally Posted by andym View Post
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.
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
Reply

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 09:45 PM.


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