简体   繁体   English

Oracle NetSuite Advanced PDF模板是否具有“分组依据”和“ SUM”功能?

[英]Does Oracle NetSuite Advanced PDF Template have “Group by” and “SUM” Functions?

重复的问题,对不起……

The full Freemarker documentation is available here . 完整的Freemarker文档可在此处获得

There are no built-in functions such as group_by() or sum() , and though you could put something together using <#list> directives etc., you would have a much easier time doing this in JavaScript using a library like lodash . 没有诸如group_by()sum()类的内置函数,尽管您可以使用<#list>指令等将某些东西放在一起,但是使用像lodash这样的库在JavaScript中执行此操作会容易得多

For more information in how to combined SuiteScript and Advanced PDF/HTML Templates, see the help section topic Using SuiteScript to Apply Advanced Templates to Non-Transaction Records , or if you are using SS2.0 see the N/render module. 有关如何组合SuiteScript和高级PDF / HTML模板的更多信息,请参见帮助部分主题“ 使用SuiteScript将高级模板应用于非事务记录” ,或者如果您使用的是SS2.0,请参见N/render模块。

If you can do the processing/grouping prior to passing data to freemarker you are better off. 如果您可以在将数据传递到freemarker之前进行处理/分组,那么情况会更好。 However if you are doing something like extending the standard transaction forms that isn't a simple option. 但是,如果您要进行诸如扩展标准交易表格之类的事情,这不是一个简单的选择。

You can simulate grouping by using sequence operations. 您可以使用序列操作来模拟分组。 (see http://freemarker.org/docs/ref_builtins_sequence.html ) (请参阅http://freemarker.org/docs/ref_builtins_sequence.html

Then: 然后:

<#assign seen_style = []>
<#list record.item?sort_by('custcol_style') as lineitem>
    <#assign lineStyle = lineitem.custcol_style>
    <#if seen_style?seq_contains(lineStyle)>
    <#else>
        <#assign seen_style = seen_style + [lineStyle]>
        <#assign styleTotal = 0>
        <#list record.item?sort_by('custcol_size') as styleItem>
           <#if lineStyle == styleItem.custcol_style>
              <#assign styleTotal = styleTotal + styleItem.quantity>
          </if>
        </#list>
       <div>${lineStyle} has ${styleTotal}</div>
   </#if>
</#list>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM