OL Learn

Cloning section with details table data

Hello

I have problem with data mapper and designer inside Connect project.

I have data mapper with PDF input and repeat steps (for multiple extractions).
I don’t know how much pages we can have (1 or more)

image

I also have template where have 1 print section (Section will be always same), but I would like to replace data dynamically from details table.

For example I have document which has 2 pages (each page has different data)

  • Inside data mapper I have few extractions
  • Doing repeats until end of statements
  • Have details table for this RECORD which has 2 items inside

Inside template I am trying to clone my section using following script:

> var printSections = merge.template.contexts.PRINT.sections;
>  
> var numClones = record.tables['detail'].length;
> 
> if(numClones > 1) 
> {
> 	for( var i = 0; i < numClones - 1; i++)
> 	{ 
> 		var clone = printSections["Invoice"].clone();
> 		clone.name = "Invoice_clone_" + i; 
> 		printSections["Invoice"].addAfter(clone); 
> 		
> 		var pageNum = record.tables["detail"][i].fields.PageNumber;
> 		var docContent = record.tables["detail"][i].fields.DocContent;
> 		
> 	}
> }

And I am able to clone my section based on number of details table items, but for my clones, there are no data visible inside.

image

Can You help me please? Is there better way to do this?