Hello, I have a suitelet that generates a result o...
# advancedpdf
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>
	</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>
</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?
I was actually able to achieve this using @michoel's comment in the previous thread, using this github reference below: https://gist.github.com/michoelchaikin/0cbe70c350e6078a356b516bc4f8ab38 Thank you @michoel!
d
TIL you can use
item_index
(normally I use
item?index
)
m
item_index
is deprecated
d
ah, didn't see that. I was looking on the Loop variable built-ins page for "_index"