GetNewRow
You can use the GetNewRow function to return a blank object for a requested detail code (tab) of an Optiva object. If the detail code has an auto-sequenced line ID column, the next sequence number is automatically populated in the new row. The DataRow acts as a container for adding data in key-value pairs before committing to the objects detail grid.
When to use
You can use this function to:
- Add new rows to detail grids or tabs in Optiva objects, such as Ingredients, Parameters, and Labels.
- Create a new detail row container for later commit.
When not to use
You cannot use this function:
- When modifying existing rows.
- For updating header or Main tab data.
Syntax
GetNewRowReturn GetNewRow(string objSymbol, string objKey, string DetailCode)
Parameters
| Parameter | Required | Type | Description | |
|---|---|---|---|---|
| objSymbol | string | Optional |
The symbol of the object.
Note: You can use empty quotation marks ("") for the current workflow symbol.
|
|
| objKey | string | Optional |
The key of the object.
Note: You can use empty quotation marks ("") for the current workflow symbol.
|
|
| DetailCode | string | Yes |
The DTLCODE (Detail Code) corresponding to specific tabs/sections in the Optiva object. For example:
|
Return Value
The application returns a DataRow object for the requested detail code.
DataRow properties
The returned DataRow:
- Has columns matching the detail grid structure.
- Has the auto-sequenced line ID populated, if configured.
- Includes default values for columns, if configured.
- Can be populated using column name indexing: row["ColumnName"] = value.
Impact
An in-memory DataRow object is created and the data is not saved to the database.
Prerequisites
The user must have permissions to add rows to the detail grid.
Examples
- Example 1
-
DataRow newIngrRow = GetNewRow("", "", "BYPROD");
- Description
-
This example returns a DataRow corresponding to the DTLCODE - BYPROD within the Byproducts tab of the current Optiva object where the workflow is running.
SeeCommitNewRow examples on how to use
newIngrRowDataRow.
- Example 2
-
DataRow newIngrRow = GetNewRow("ITEM", "SALT", "LABEL");
- Description
-
This example returns a DataRow corresponding to the DTLCODE - LABEL within the Labels tab of item SALT.
- Example 3
-
DataRow drNewRow1 = GetNewRow("LABELCONTENT", "LC\001", "MCLAIM");
- Description
-
This example returns a DataRow corresponding to the DTLCODE - MCLAIM within the Manual Claims tab of Label Content LC\001.
Edge Cases
- The function returns null, if the object or detail code do not exist.
- The function returns null, if the detail code is not configured for the object type.
- Specifying a non-existent object key returns null.
- If required columns are not populated, CommitNewRow fails.
- If incompatible data types are assigned to columns, an error occurs.