Adding NetSuite Data to the Template File
To add NetSuite data to your HTML report template, use FreeMarker, a Java library used to generate text outputs based on templates and dynamic data. FreeMarker interpolations will enable you to include NetSuite content in the template. An interpolation is an expression, such as ${record.entity} which is replaced in the output with the actual value of the expression. For complete information about FreeMarker, see the FreeMarker documentation
Every template consists of a number of cells with IDs that you create yourself. Valid Cell ID must start with a letter (A-Z) and it must not contain white spaces. Also, it must only consist of alphabetic characters, numeric characters, or the underscore (_) symbol. Finally, it must be unique (you cannot have multiple variables with the same Cell ID in one report).
Note that to comply with the FreeMarker syntax rules, all variables in your template must be prefixed with the $ sign. Therefore, follow these conventions when adding different types of variables to your cells:
-
Cells containing text – If you want to use a variable containing text only in your cell, use the "name" attribute. The math part of such variable will be ignored. To learn more about variables created by the Country-Specific Reports SuiteApp, see Variables in Country-Specific Reports.
The following example shows how the text variable with cell ID MY_VARIABLE should look like in your template:
<p>${VAR.MY_VARIABLE.name}</p>
-
Cells containing math operations – If you want to use a variable containing sums and differences in your cell, use the "value" attribute (or "value2" if your report uses the second comparative column). The text part of such variable will be ignored. To learn more about variables created by the Country-Specific Reports SuiteApp, see Variables in Country-Specific Reports.
The following example shows how the math variable with cell ID MY_VARIABLE should look like in your template:
<p>${VAR.MY_VARIABLE.value}</p>
Note:If your variable has both text (Name) and math operations (Sum of Values) defined, you can apply it as both a text variable and as a math variable (in different cells of your report). To do so, use a different attribute (“name” or “value”) as shown in the examples above.
-
Cells containing system variables -System variables add various information to your report drawing data from the NetSuite system. These variables must be added directly to your template and must start with a prefix SYS (for example, SYS.companyaddress). To learn more about the system variables (and to view the list of all system variables available), see System variables.
The following example shows how the system variable User Name should look like in your template:
<p>${SYS.username}</p>
Note:Unlike standard variables, the system variables are added directly to your HTML/XML report template. It means that you don’t have to create separate NetSuite records for them.
-
Cells containing filter variables -Filter variables contain information about filters currently selected in the report. This is particularly important in exported files -the data in them depend on selected filters. These variables must be added directly to your template and must start with a prefix FLT (for example, FLT.subsidiary). To learn more about the filter variables (and to view the list of all filter variables available), see Filter variables. To learn more about filters in the Country-Specific Reports SuiteApp, see Filters in Country-Specific Reports.
The following example shows how the filter variable Subsidiary Context should look like in your template:
<p>${FLT.subsidiary}</p>
Note:Unlike standard variables, the filter variables are added directly to your HTML/XML report template. It means that you don’t have to create separate records for them.
System variables
The system variables add certain information to your report using data obtained from NetSuite records. Unlike standard variables, system variables have to be added directly to your HTML/XML report template. You can identify system variables through the prefix SYS.
Name |
ID |
Description |
---|---|---|
Company Address |
SYS.companyaddress |
Information from Setup > Company > Company Information (Address field in Addresses subtab). |
Company Name |
SYS.companyname |
Information from Setup > Company > Company Information (Company Name field). |
Date and Time |
SYS.datetime SYS.date SYS.time |
Time and date when this report was generated. This time stamp can be adjusted in the Formatting section of the Set Preferences dialog (General subtab). |
Format: decimal separator |
SYS.formatdecseparator |
The decimal separator. Either “.” or “,”. |
Format: negative numbers |
SYS.formatnegnumenum |
The same as using the Negative Number Format dropdown list in the Formatting section of the Set Preferences dialog (General subtab). |
Format: numbers |
SYS.formatnumenum |
The same as using the Number Format dropdown list in the Formatting section of the Set Preferences dialog (General subtab). |
Format: thousands separator |
SYS.formatthousseparator |
The thousands separator. Either “.”, “,”, or “ “. |
Show or Export |
SYS.isexporting |
Checking whether this report will be displayed in the Country-Specific Reports (value 0) dashboard or exported (value 1). For exported reports, the template will be adjusted to improve exported report’s appearance. |
OneWorld |
SYS.isow |
Checking whether this is a OneWorld account. |
User Name |
SYS.username |
Name of the user who displayed this report (in a format “FirstName MiddleName(s) Surname”. |
Subsidiary Address |
SYS.subsidiaryaddress |
Available only if Subsidiary filter is present on this report. Information about selected subsidiary selected subsidiary is displayed (Parent company, inactive, consolidated, specific subsidiary). |
Currency Symbol |
SYS.currencysymbol |
Displays the currency symbol. For example: €. |
Currency Code |
SYS.currencycode |
Displays the currency code. For example: EUR. |
Totals label |
SYS.totalstring |
Displays the text Total before the number. This text is translatable. |
When you open a report containing a system variable that is not available, this variable will be highlighted in red. You should consider deleting it from your report.
Filter variables
The filter variables contain information about filters currently selected in the report. This is particularly important in exported files, because the data that they contain depend on selected filters. Unlike standard variables, you have to add them directly to your HTML/XML report template. Listed below are the filter variables that can be used in reports created by this SuiteApp:
Name |
ID |
Description |
---|---|---|
Accounting Book |
FLT.accountingbook |
Displays the value selected in the Accounting Book filter. |
Period From |
FLT.periodfrom |
Displays the value selected in the Period From filter. |
Period To |
FLT.periodto |
Displays the value selected in the Period To filter. |
Comparative Period From |
FLT.periodfrom2 |
If you use the comparative column in your report, this filter will display the value selected in the Period From filter minus one year. |
Comparative Period To |
FLT.periodto2 |
If you use the comparative column in your report, this filter will display the value selected in the Period To filter minus one year. |
Subsidiary Context |
FLT.subsidiary |
Displays the value selected in the Subsidiary Context filter. |
When you open a report containing a filter variable that is not available (the filter that it refers to is not present on this report), this variable will be highlighted in red. You should consider deleting it from your report.
To learn more about filters in the Country-Specific Reports SuiteApp, see Filters in Country-Specific Reports.
Related Topics
- Country-Specific Reports Overview
- Enabling Required Features for the Country-Specific Reports SuiteApp
- Installing the Country-Specific Reports SuiteApp
- Creating a Template for the Country-Specific Reports SuiteApp
- Viewing Country-Specific Reports
- Adding and Editing Report Elements
- Working with Reports
- Roles and Permissions in Country-Specific Reports