Document Capture Line Object Members in SuiteScript 2.1
Line object members in SuiteScript 2.1 include confidence levels and text extraction capabilities, enhancing document processing.
The Line object within the document capture context in SuiteScript provides key member properties that can be leveraged by developers for improved document processing. This includes the confidence levels of extracted text, allowing scripts to filter results based on reliability.
What Are Line Object Members?
Line object members represent properties related to the lines of text extracted from documents, particularly when using the N/documentCapture module in SuiteScript 2.1. The two primary members are:
| Member Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
| Line.confidence | number | Server scripts | The confidence level for the line. |
| Line.text | string | Server scripts | The actual text of the line. |
Understanding the Line.confidence
The Line.confidence property is a numerical value ranging from 0 to 1, representing the service's certainty about the accuracy of the extracted line text. For example, a value of 0.95 indicates that the service is 95% confident regarding the accuracy of the corresponding text. Developers can utilize this value to set thresholds for accepting or rejecting text lines in their scripts, thereby minimizing the risk of error. For instance, one might only pursue lines with a confidence greater than 0.9.
Implementing Line.text
The Line.text property provides the actual extracted text from the document line. This text can be utilized in various script processes, including data validation and storage.
Error Handling
Both properties are read-only, meaning developers cannot assign values to them, which helps maintain data integrity. The error code READ_ONLY is thrown if any attempts are made to modify these properties.
Sample Syntax
Below are syntax examples demonstrating how to utilize these members.
Example for Line.confidence
1// Code snippet to accept or reject a line based on confidence level2const extractedData = documentCapture.documentToStructure({3 file: file.load("SuiteScripts/sample_invoice.pdf"),4 documentType: documentCapture.DocumentType.INVOICE,5 features: [documentCapture.Feature.TEXT_EXTRACTION]6});7 8const lineToProcess = extractedData.pages[0].lines[0];9 10if (lineToProcess.confidence > 0.9) {11 // Accept the line12} else {13 // Reject the line14}Example for Line.text
1// Code snippet to retrieve line text2const extractedData = documentCapture.documentToStructure({3 file: file.load("SuiteScripts/sample_parking_application.pdf"),4 documentType: documentCapture.DocumentType.OTHERS,5 features: [documentCapture.Feature.TEXT_EXTRACTION]6});7 8const lineText = extractedData.pages[0].lines[0].text;9// Use lineText as neededIn summary, the Line object members in SuiteScript 2.1 enhance the functionality of document processing by providing reliable mechanisms for text extraction and validation based on confidence levels, thus simplifying the automation of document-related tasks.
Frequently Asked Questions (4)
How can I utilize the confidence property in SuiteScript 2.1 to filter extracted text lines?
Are there any error handling considerations when working with Line object members in SuiteScript 2.1?
What script types support the use of Line object members in SuiteScript 2.1?
Is it possible to modify the text extracted using the Line.text property in SuiteScript 2.1?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
