Hello, I have a suitelet that generates a result o...
# suitescript
k
Hello, I have a suitelet that generates a result of a saved search and uses that data to renders an advanced pdf template. Within the pdf template, I have a table that lists out the results of the saved search. I need to break the table and insert a page break and have the element below start in a new page, when a certain condition is met. This is a sample code snippet I have to do so:
Copy code
<#assign currentRoute = ''>

<#list results as result>
<#if result_index==0>
	<tr class="header">
	<td colspan="2">Route</td>
	<td colspan="2">Vendor</td>
	<td colspan="4">Account</td>
	<td colspan="4">Product</td>
	<td colspan="6">Description</td>
	<td colspan="2">Unit</td>
	<td colspan="2">Quantity</td>
	</tr>
</#if>

<#if result_index==1>
  <#assign currentRoute = result.custbody_currentRoute>
</#if>

<#if result_index==2>
  <pbr />
</#if>

<tr>
	<td colspan="2">${result.custbody_currentRoute}</td>
	<td colspan="2">${result.formulatext}</td>
	<td colspan="4">${result.customerMain.entityid}</td>
	<td colspan="4">${result.item.displayname}</td>
	<td colspan="6">${result.item}</td>
	<td colspan="2">${result.unitabbreviation}</td>
	<td colspan="2">${result.quantity}</td>
</tr>

</#list>
I am using the
pbr />
tag to do so (right now with a hardcoded condition). However, adding the
pbr />
tag in the pdf template is throwing me an error. Could someone help me with this?
j
I don’t know if you can <pbr/> in the middle of a table. Try exiting the table and reentering it.
Copy code
<#if result_index==2>
</table>
<pbr/>
<table>
	<tr class="header">
		<td colspan="2">Route</td>
		<td colspan="2">Vendor</td>
		<td colspan="4">Account</td>
		<td colspan="4">Product</td>
		<td colspan="6">Description</td>
		<td colspan="2">Unit</td>
		<td colspan="2">Quantity</td>
	</tr>
</#if>
something like this
k
Hi, thank you for the response! I was actually able to resolve with that logic, by inserting pbr in between tables. thank you!