FreeMarker Functions in the Template Utility
This table lists the FreeMarker functions used in the WD_GridOE_TemplateUtils.xml template utility file. This file is located in the SuiteBundles > Bundle 41296 > src > GridPrinting folder on the File Cabinet.
Before using other functions, you must first call getItemDetails or getItemOrderedShippedQty functions. Other functions in the utility file depend on the item details in the JSON data.
You can find the following FreeMarker functions in the utility file when you create custom grid print templates.
|
FreeMarker Function |
Parameters |
Description |
Sample |
|---|---|---|---|
|
min(val1, val2) |
val1, val2 – compares numeric values |
This function returns the lower value between parameters val1 and val2. |
FTL:
Output: 1 |
|
getItemDetails(items) |
items – accepts record.item, which is the current transaction’s item list |
This function traverses through the item lines in the transaction. Then this function returns a JSON data with the following pattern:
The JSON data stores the same items with collated quantities. If the item rates differ, the JSON data stores the rate of the item’s latest entry. |
record.item:
FTL:
Output:
|
|
get |
salesorder – corresponding sales order or transfer order transaction record of the current item fulfillment items – accepts record.item, which is the current transaction's item list |
You can use this function in packing slips. This function traverses through the item lines in the current sales order or transfer order related to the item fulfillment. Then, this function returns a JSON data with the following pattern:
The JSON data stores only the items found in both item fulfillment and sales order or transfer order transactions. The JSON data also stores the same items with collated quantities, shipped quantities, and backordered quantities. |
salesorder.item:
record.item: (IF)
FTL:
Output:
|
|
getRowColLabel |
gridData – grid data from record.custbody_ |
When the gridData.type is “MI”, the output returns the label stored in gridData.grid.rowcollabel. When the gridData.type is not “MI”, the output returns “gridData.grid.rowlabel / gridData.grid.collabel”. |
gridData[0]:
gridData[1]:
FTL:
Output: "Main Label" "Color / Size" |
|
getRowColumnData(row, col, subcolumn) |
row – accepts gridData.grid.data element col – accepts gridData. subcolumn – accepts subcolumns (Rate, Qty) |
The loop for gridData.grid.data that traverses the rows and columns must call this function. This function gets the corresponding subcolumn data for the current row and column of the loop from itemDetails. When subcolumn is picked, the output returns blank. When subcolumn is rate, the output formats to currency 0.00. |
itemDetails:
FTL:
Output: 100.00 999 "" |
|
getRowTotal(row, subcolumn) |
row – accepts gridData.grid.data element subcolumn – accepts subcolumns (Rate, Qty) |
The loop for gridData.grid.data that traverses the rows and columns must call this function. This function gets the corresponding subcolumn total for the current row of the loop from itemDetails. |
gridData.grid.data:
itemDetails:
FTL:
Output: 200 1000 |
|
getColumnTotal (rows, column, subcolumn) |
row – accepts gridData.grid.data column – accepts gridData. subcolumn – accepts subcolumn (Rate, Qty) |
The loop for gridData.grid.data.columnids that traverses the rows and columns must call this function. This function gets the corresponding subcolumn total for the current column of the loop from itemDetails. |
gridData[0].grid.data::
gridData[1].grid.data:
itemDetails:
FTL:
Output: 200 1000 |
For information about the other elements included in Grid Print Templates, see the following topics: