Create one Cover Letter with multiple 2nd pages depending on data

I have a template that has a banner, cover letter, questionnaire(s), and trailer pages. The banner and trailer print once per run. The cover letter needs to print once per record, and the questionnaire will print one-to-many per record. Each questionnaire will have different variable data on it. For example, John Q Public is getting a cover letter, and needs to answer questionnaires regarding his attendance at 3 different schools, School A, School B, and School C. Therefore, he needs 3 questionnaires, one with variable data for School A, one for School B, and one for School C.

I only have Designer, I don’t have access to Workflow. We send our package files to our print plant to create our workflows and print our documents. My question is: how do I get the multiple questionnaires to print for each record? My Record breaks with each instance of “E385EC” and the questionnaires break with each instance of "E385EF’. Here is a sample “dummy” data file (only one record):

+$DJDE FORMS=E385EC,PMODE=PORTRAIT,FONTS=(P08TAC,CS10NP,P08TBA,P07TYA,CS10BP,HL08NP),;
+$DJDE BEGIN=(1.70,1.00),;
+$DJDE BEGIN=(2.24,1.00),;
+$DJDE DUPLEX=NO,SIDE=NUFRONT,END;
14April 6, 2017.
10JOHNNIE A CLAIMANT CID:99-999.999.999
0ADDRESS LINE 1 BYE:11/18
0CITY ST ZIP5#-ZIP4
0
0
+$DJDE FORMS=E385EF,PMODE=PORTRAIT,FONTS=(P08TAC,CS10NP,P08TBA,P07TYA,CS10BP,HL08NP),;
+$DJDE BEGIN=(0.55,2.90),;
+$DJDE BEGIN=(0.84,0.02),;
+$DJDE DUPLEX=NO,SIDE=NUFRONT,END;
10TEST SCHOOL #1
10 NAME:JOHNNIE A CLAIMANT CID:99-999.999.999 BYE:11/18 FO:040
+$DJDE FORMS=E385EF,PMODE=PORTRAIT,FONTS=(P08TAC,CS10NP,P08TBA,P07TYA,CS10BP,HL08NP),;
+$DJDE BEGIN=(0.55,2.90),;
+$DJDE BEGIN=(0.84,0.02),;
+$DJDE DUPLEX=NO,SIDE=NUFRONT,END;
10 TEST SCHOOL #2
10 NAME:JOHNNIE A CLAIMANT CID:99-999.999.999 BYE:11/18 FO:040
+$DJDE FORMS=E385EF,PMODE=PORTRAIT,FONTS=(P08TAC,CS10NP,P08TBA,P07TYA,CS10BP,HL08NP),;
+$DJDE BEGIN=(0.55,2.90),;
+$DJDE BEGIN=(0.84,0.02),;
+$DJDE DUPLEX=NO,SIDE=NUFRONT,END;
10 TEST SCHOOL #3
10 NAME:JOHNNIE A CLAIMANT CID:99-999.999.999 BYE:11/18 FO:040
+$DJDE FORMS=E385EF,PMODE=PORTRAIT,FONTS=(P08TAC,CS10NP,P08TBA,P07TYA,CS10BP,HL08NP),;
+$DJDE BEGIN=(0.55,2.90),;
+$DJDE BEGIN=(0.84,0.02),;
+$DJDE DUPLEX=NO,SIDE=NUFRONT,END;
10 TEST SCHOOL #4
10 NAME:JOHNNIE A CLAIMANT CID:99-999.999.999 BYE:11/18 FO:040
+$DJDE FORMS=E385EF,PMODE=PORTRAIT,FONTS=(P08TAC,CS10NP,P08TBA,P07TYA,CS10BP,HL08NP),;
+$DJDE BEGIN=(0.55,2.90),;
+$DJDE BEGIN=(0.84,0.02),;
+$DJDE DUPLEX=NO,SIDE=NUFRONT,END;
10TEST SCHOOL #5
10 NAME:JOHNNIE A CLAIMANT CID:99-999.999.999 BYE:11/18 FO:040

This is currently what I have as a control script to get everything to print (it prints one cover letter and questionnaire per record, and the banner and trailer):
//Page Control
var printSections = merge.template.contexts.PRINT.sections;
var CurrentRecord = record.index.toString();

// Array of Print Sections (Must be name of your print sections)
var ArrLang = [“E385EC”, “E385EF”, “Banner”, “Trailer”];
var arrayLength = ArrLang.length;

// Disable all Print Sections
for (var i = 0; i < arrayLength; i++) {
printSections[ArrLang[i]].enabled = false;
}

//Enable Banner Page
if (CurrentRecord == ‘1’) {
printSections.Banner.enabled = true;
}

var cid = record.fields.CID;

if(cid != ‘’)
{printSections[“E385EC”].enabled = true;
printSections[“E385EF”].enabled = true;}

//Trailer Page
if (record.index == record.fields.Trailer_Count) {
merge.context.sections.Trailer.enabled = true;
}

I know I need help in the section where I’m printing the pages. Any help would be greatly appreciated.

Thanks,
Alesa

with the multiple questionnaire data you have a sort of transactional record data, so you would need to set up the datamapper to loop through these transactional data, and in designer you need to print these transactional data (detail records) on the questionnaire section page, one page per transactional record. That’s a bit tricky but should be doable I guess.

Hi Martin,

Thanks for the suggestion. I’ve already got the datamapper set up to loop through the transactional data (I tried to paste a pic of my datamap, but it won’t let me). I’m having trouble with the designer printing it. Also, when I try to validate my records, it shows an out-of-bounds error: Document: 5 The step is out of bound ={1} (DME000130). So I’m at a loss as to where to go from here.

Alesa

Hi Alesa,

getting the datamapper to step through the details records isn’t that difficult.

First you need to do your extractions for the main record fields (before the first FORMS=E385EF", supposed your document boundaries are set up on “FORMS=E385EC”), then at the end of the main part have a GOTO (type: Next occurance of expression “FORMS=E385EF”), after that put a Repeat loop with just “Until no more elements”. Inside the Repeat loop you first have your extractions of fields you need for the details data and last step of Repeat is another GOTO ( same as above: Next occurance of “FORMS=E385EF”). That’s it for the datamapper.

I think your question might be summarized as “How do I use a DETAIL TABLE from my Data Map within my Print template?”

The answer is “Insert Detail Table”. By default, a “Detail Table” inside of a Template will loop through each Detail Record of your data map, and automatically paginate if required. So if your entire questionnaire was built inside of the “td” of the template’s detail table, and that content exactly fills the page, then going to the next detail record should emit a new page.

Note that when you go through the Insert Detail Table wizard and pick which fields from your detail table (data map) you wish to use, a new script / variable name is created for the detail records. This is important! You don’t use the field names from your data map… use the newly created names as shown in the SCRIPTS panel.

Thomas Greer

Thank you, Thomas.

Hi Thomas

I found this solution that will fit to my requirement. Only one tweak I have to do. I need 1 detail table record to spread to more than 1 pages.

I made 2 Print Duplex Section (4 pages documents). 1 customer can have 1 or more table detail records. Will HTML Table structure can work only for 1 page? How I can reference the same table row index in the script on different pages?

Thanks