LimitingFilter Object Members for SuiteScript Development
The LimitingFilter object allows for effective result filtering in SuiteScript workbooks, enhancing data handling capabilities.
The LimitingFilter object is pivotal in SuiteScript development, particularly in scenarios requiring data manipulation through workbook creation. This object is essential when you want to filter results in pivot tables, allowing for finer control of how data is aggregated and displayed.
What is the LimitingFilter Object?
The LimitingFilter object is utilized in the workbook module to constrain the results generated by pivot tables. It is created using the workbook.createLimitingFilter(options) function and is passed as a parameter to the workbook.createPivot(options) method. This allows developers to filter and limit data effectively while creating custom reports.
Members of the LimitingFilter Object
The LimitingFilter object contains several members, each serving a unique purpose in the filtering process. Below is a detailed overview of its members:
| Member Name | Type | Supported Script Types | Description |
|---|---|---|---|
LimitingFilter.filteredNodesSelector | workbook.PathSelector or workbook.DimensionSelector | Server scripts | Defines the specific criteria to filter selected nodes. |
LimitingFilter.limit | number | Server scripts | Sets the maximum number of records returned by the filter. |
LimitingFilter.row | boolean | Server scripts | Indicates whether the filter operates on row axes. |
LimitingFilter.sortBys | Array<workbook.SortByDataDimensionItem> or Array<workbook.SortByMeasure> | Server scripts | Specifies the sorting order for the filtered results. |
Example Syntax
The following code snippet demonstrates how to create a LimitingFilter object:
1// Creating a limiting filter object2var myLimitingFilter = workbook.createLimitingFilter({3 row: true,4 sortBys: [myMeasureSort],5 limit: 12,6 filteredNodesSelector: myDimensionSelector7});In this example, the limiting filter is set to allow a maximum of 12 records, with results sorted based on specified measurement criteria.
Error Handling
When working with LimitingFilter, be aware of potential error codes that may occur:
WRONG_PARAMETER_TYPE: This error is thrown if an invalid type is passed for thefilteredNodesSelectorproperty. Ensure it matches eitherworkbook.PathSelectororworkbook.DimensionSelector.
By incorporating LimitingFilter objects, SuiteScript developers can significantly enhance the capabilities of their data presentations, making it easier to work with large datasets by focusing on relevant information.
Key Considerations
- The
workbook.createLimitingFilterfunction requires familiarity with defining and limiting data selections. - Proper parameter types must be adhered to, ensuring the script runs without error.
This approach not only optimizes performance but also improves the user experience when interacting with data reports.
Frequently Asked Questions (4)
Does the LimitingFilter object apply to both SuiteScript client and server scripts?
What happens if I pass an incorrect type to the filteredNodesSelector property in a LimitingFilter object?
Do I need to configure anything before using LimitingFilter with pivot tables?
Can the LimitingFilter object be used to sort results in a pivot table?
Was this article helpful?
More in SuiteScript
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
- Enhancements to SuiteScript User Role Context Clarification
SuiteScript updates clarify the user and role contexts for script executions, improving deployment understanding and management.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category