ObjProperty
You can use the ObjProperty function to retrieve a field value from the database and store it in a local variable. You can also use the function to retrieve an array of data.
Usage
You can use the ObjProperty in 3 types based on the field types. Possible values:
- Simple field - Header fields such as Description, Status, or an extension field.
- Column of data in a table where all the rows can be returned to the variable, For example, All item codes in the item lines table.
- Specific cell of a table. For example, PValue for the DENSITY parameter in Parameters table or grid or the qty of a specific item in the item lines table.
When to use
You can use this function to:
- Retrieve values from header fields, such as DESCRIPTION and CLASS.
- Extract entire columns of data from Optiva data grids (DTLCODES).
- Access specific cell values in detail tables.
- During data validation workflows requiring field values.
When not to use
You cannot use this function when a DataSet function is more appropriate for retrieving rows in a detail table.
Syntax
object ObjProperty(string propertyName, string objSymbol, string objectKey, string rowkey, string keycol)
Parameters
| Parameter | Description |
|---|---|
| propertyName | The name of the field that must be retrieved. |
| objSymbol |
The symbol of the object.
Note: You can use empty quotation marks ("") for the current workflow symbol.
|
| objKey |
The key of the object.
Note: You can use empty quotation marks ("") for the current workflow symbol.
|
| rowkey | Required when accessing table data. |
| keycol | Required when rowkey is used to identify a specific table row. |
- propertyName
-
The
propertyNameparameter represents the name of the field you want to retrieve. It is a combination of the field name and, depending on the attribute type, a detail code and other identifiers.The references for field name and detail code include:
- Data Dump from a representative object.
- Field Label form.
- Validation form or the FsValidationField database table.
- Extension table definition form
- Lookup Set form
- Symbol form, on the Extensions tab
Different ways to frame propertyName argument
- Type 1 attributes (simple field name only):
-
- Most header fields, except Security and Status fields, do not require a detail code, rowkey, or keycol.
- This group includes standard fields and all extension fields.
- For extension fields, you can find the field name on the Extensions tab of the Symbol form where the field was created.
- For header fields, you can find the exact field name in the Field Label form. For example, DESCRIPTION, CLASS, COMPONENTIND, C_FACILITY.
- Type 2 attributes (Simple field + Detail code, no RowKey/KeyCol)
-
- Status and Security fields return a single value but require a detail code.
- Status fields use PER as the detail code.
- Status fields include fields on the Security tabs, such as Owner Code and Security, Group Code and Security, and Role Security.
- Security fields use the validation code G.OBJSECURITY in the Field Label and Validation forms and tables. For example, STATUSIND.STATUS, EFFDATESTART.STATUS, OWNERCODE.PER, ROLESECURITY.PER
- Type 3 attributes (single-table data)
-
The
propertyNamerequires a detail code. Certain tables, such as Extension tables, References, and Views, require additional processing beyond the detail code. This additional processing is referred to as Type 4 logic.To construct the
propertyNameargument for most table attributes:- Find the detail code (DTLCODE) for the required attribute in the objectdtlinfo table in the data dump for the required object type. The detail codes are generally logically named as DOC, TPALL, INGR, ALTINGR, and BYPROD.
- Find the corresponding VALIDCODE from the same objectdtlinfo table. For example, G.FORMINGRED or G.SPECPARAM.
- Open the Field Label form and select the VALIDCODE as the validation code.
- Find the required field name in the Data Name column.
You can also use the Validation form instead of the Field Label form. The Validation form can be used instead of the field label and does not include the UI label and requires a profile attribute that provides access to columns beyond ATTRIBUTEx.
- Examples:
- VALUE.TPALL, TARGET.TP, QUANTITY.INGR, LABCODE.USERROLE
Note: The field name must exactly match the value in the Data Name column of the Field Label form or the FIELD_NAME column of the Validation form. You can also use DB_NAME if required.
- Type 4 (multi-table data):
-
Some detail types use multiple tables within a single object, including Extension Tables, References, and Views (Reports).
The parameter data is stored across multiple tables. The filter selections represent a single table (TPALL or TP) and follow Type 3 logic.
-
-
For multi-table data, the
propertyNameargument is: -
fieldname.DetailCode.TableIdentifier.
-
For multi-table data, the
-
- For Extension Tables
-
- Use the generic field name specified in the Extension Table form, such as FIELD1, FIELD2, etc
- Use MATRIX as the detail code.
- Use the View ID from the table definition to construct the table identifier. The format is:
V\DMsymbol+view ID
- For example, the
propertyNamefor retrieving data from the third column of an Item extension table with View ID 4 is FIELD3.MATRIX.V\DMITEM4.
-
- For References
-
- The field name is not displayed in the Field Label form. Use the Validation form with the validation code
V\REFERENCEto find the field name. - Use REF as the detail code.
- Use V\lookup code as the table identifier.
- For example, to find the lookup code for the Vendor reference on Items, open the
V\REFITEMLookup Set. The lookup code for the Vendor reference isV\REFITEM1
- The field name is not displayed in the Field Label form. Use the Validation form with the validation code
Lookup Code Description V\REFITEM1 Item reference to vendors. V\REFITEM2 Item reference to customers. V\REFITEM3 Item reference to specs. V\REFITEM4 Item reference to programs.
The resultingpropertyNamefor the Reference Status column is:REFSTATUS.REF.V\REFITEM1
-
- rowkey
- This property is required when accessing table data.
- Case 1
-
You can use only the asterisk (*) in double quotation marks to access all rows of the column, such as all item codes in the formula item lines table. For example: ObjProperty("ITEMCODE.INGR", "", "", "*"); .
- Case 2
- Retrieve data from a specific table cell.
- keycol
- This property is required when a rowkey is specified to retrieve table data.
- Case 1
-
When you use (*) as the rowkey, you can omit the column key. You can also use a placeholder such as "" or 1. For example: ObjProperty("ITEMCODE.INGR", "", "", "*", 1);
- Case 2
-
Accessing a specific cell of the table.
- The column key is the DB_FIELD_NAME in the Validation form or table of the column that holds the rowkey value.
Note: The field name of the column must not be used.
- Optionally, the FIELD_NO of the reference column divided by 100 can be used, but using the DB_FIELD_NAME is less likely to change over time or have a copy or paste error from some other line of code.
Examples:ObjProperty(“VALUE.TPALL”, “”, “”, “DENSITY”, “PARAM_CODE”);
ObjProprety(“ITEMCODE.INGR”, “”, “”, x.ToString(), “LINE_ID”); //where x is a loop count variable
- The column key is the DB_FIELD_NAME in the Validation form or table of the column that holds the rowkey value.
Return Value
The application returns the value as an object.
- The data type of the result depends on the type of field. The result can be a single value or an array of values.
- When programming in C#, automatic conversions are not allowed. Immediately converting the result to a string or numeric data type can result in an error if the attribute is blank.
Prerequisites
- The field or column names must be valid for the object type.
- The key column must be valid for table queries.
- The row key values must match existing data.
- The fields that are displayed under the header or Main tab are referred to as header fields.
- These fields can vary depending on the form or symbol.
- The common header fields include Description, Class, Status, and Approval Code.
Examples
- Example 1
- (Header Data Examples) Retrieving the value of STATUS for formula PIZZA/0001.
- Example 2
- (Header Data Examples) Retrieving the value of CLASS for any item.
Function Call: ObjProperty("CLASS", "ITEM", "");
object sItemClass = ObjProperty("CLASS", "ITEM", ""); MessageList("The item type is: ", sItemClass.ToString());
- Example 3
- Retrieving the value of DESCRIPTION for any ITEM.
- Example 4
-
Retrieving the value of DENSITY parameter for any ITEM/FORMULA.
The syntax of
ObjProperty -> ObjProperty(string propertyName, string objSymbol, string objectKey, string rowkey, string keycol)
- The objSymbol is ITEM/FORMULA and objectKey is the current object on which the workflow is launched.
- Empty quotations can be used. The parameter values fields:
- VALUE – Represents the actual value of the parameter.
- MINVAL – Indicates the minimum permissible value.
- MAXVAL – Indicates the maximum permissible value.
- DTLCODE can be found in the object specifc objectdtlinfo table. All the DTLCODES related guide will also be attached for reference.
- Consider these tables for reference - TPALL is the detail code for Parameters on Items, Formulas and Projects.
Note: for Label Content and Specification, the detail code is “TP”
- objectdtlinfo (For ITEM)
-
SYMBOL DTLCODE TABLENAME VALID_CODE ITEM DESCR FSDESCRIPTION G.DESCR ITEM ST FSITEMST G.SETITEM ITEM LABEL FSITEMLABEL G.ITEMLABEL ITEM MATRIX FSITEMMATRIX V\DATAMATRIX ITEM STATUS FSITEMSTATUS G.OBJSTATUS ITEM TPALL FSITEMTPALL G.TECHPVAL
- objectdtlinfo (For FORMULA)
-
SYMBOL DTLCODE TABLENAME VALID_CODE FORMULA DESCR FSDESCRIPTION G.DESCR FORMULA ST FSFORMULAST G.SETFORMULA FORMULA INGR FSFORMULAINGR G.FORMINGRED FORMULA BYPROD FSFORMULABYPROD G.FORMBYPROD FORMULA STATUS FSFORMULASTATUS G.OBJSTATUS FORMULA TPALL FSFORMULATPALL G.TECHPVAL FORMULA REF FSFORMULAREF V\REFERENCE
- The table under VALID_CODE for DTLCODE TPALL : G.TECHPVAL
-
VALIDATION_CODE VALIDATION_SUBCODE FIELD_NAME FIELD_NO G.TECHPVAL DENSITY MAXVAL 200 G.TECHPVAL DENSITY MINVAL 200 G.TECHPVAL DENSITY VALUE 200 G.TECHPVAL FATS_SATS MAXVAL 200 G.TECHPVAL FATS_SATS MINVAL 200 G.TECHPVAL FATS_SATS VALUE 200
- Code snippet:
-
object oDens = ObjProperty("VALUE.TPALL", "", "", "DENSITY", "PARAM_CODE");
- If (IsBlank(oDens) == 0)
-
MessageList("Density value is : " + oDens.ToString());Note: Any data related to fields(with VALIDATION_SUBCODE) can be retrieved for any object in the above described way.
- Example 5
- Retrieving the Context attribute of any codes for SPECIFICATION SPEC/0001.
- objectdtlinfo (For SPECIFICATION)
-
SYMBOL DTLCODE TABLENAME VALID_CODE SPECIFICATION PER FSSPECIFICATIONPER G.OBJSECURITY SPECIFICATION DESCR FSDESCRIPTION G.DESCR SPECIFICATION MATRIX FSSPECIFICATIONMATRIX V\DATAMATRIX SPECIFICATION INGR FSSPECIFICATIONINGR G.SPECINGRED SPECIFICATION CONTEXT FSSPECIFICATIONCONTEXT G.OBJECTCONTEXT SPECIFICATION STATUS FSSPECIFICATIONSTATUS G.OBJSTATUS SPECIFICATION CUSTOM FSSPECIFICATION_CUSTOMATTRIB G.CUSTOM
- The table under VALID_CODE for DTLCODE TPALL : G.OBJECTCONTEXT (The Validation details for Context are global to all object types)
-
VALIDATION_CODE VALIDATION_SUBCODE FIELD_NAME DB_FIELD_NAME G.OBJECTCONTEXT ATTRIBCODE ATTRIB_CODE G.OBJECTCONTEXT DESCRIPTION DESCRIPTION G.OBJECTCONTEXT ATTRIBVAL ATTRIB_VAL G.OBJECTCONTEXT C_BRAND ATTRIBVAL ATTRIB_VAL G.OBJECTCONTEXT C_ENDUSE ATTRIBVAL ATTRIB_VAL G.OBJECTCONTEXT C_ENDUSER ATTRIBVAL ATTRIB_VAL G.OBJECTCONTEXT C_PRODTYPE ATTRIBVAL ATTRIB_VAL G.OBJECTCONTEXT MFGLOC ATTRIBVAL ATTRIB_VAL G.OBJECTCONTEXT SELLOC ATTRIBVAL ATTRIB_VAL The field_name related to the specific Attribute code, in this case C_BRAND. The Field name available for the attribute types is ATTRIBVAL
propertyName : ATTRIBCODE.CONTEXT (FIELD_NAME - ATTRIBCODE, DTLCODE - CONTEXT)
- propertyName : ATTRIBCODE.CONTEXT (FIELD_NAME - ATTRIBCODE, DTLCODE - CONTEXT)
- objSymbol : SPECIFICATION
- objectKey : SPEC/0001
- rowkey : It Indicates the key(ATTRIB_CODE) - C_BRAND
- keycol : Brand, Selling Location, etc. are attribute codes, so the keycol is the DB_FIELD_NAME ATTRIB_CODE.
Function Calls: ObjProperty("ATTRIBVAL.CONTEXT", "SPECIFICATION", "SPEC/0001", "C_BRAND", "ATTRIB_CODE"); Code : var oAttribVal = ObjProperty("ATTRIBVAL.CONTEXT", "SPECIFICATION", "SPEC/0001", "C_BRAND", "ATTRIB_CODE"); MessageList("context val: " + oAttribVal.ToString());
The data resulting from this
ObjPropertycall will be nothing/null if there are no Brands, a string if there is only one Brand, and an array if there are multiple.Therefore, the use of the
oAttribValvariable needs to be tested before passing to an alert message or other code, and often the simplest approach is to always create an array from the result such as this example that converts theObjPropertyresult into an array of either 1 or multiple values.var RawValue = ObjProperty("ATTRIBVAL.CONTEXT", "", "", "MFGLOC", "ATTRIB_CODE"); if (RawValue is not null && RawValue is Array) { string[] ContextValues; if (RawValue is Array) { ContextValues = (string[])RawValue; } else { ContextValues = new string[1]; ContextValues[0] = RawValue.ToString(); } }
- Example 6
-
The following example demonstrates how to call functions to retrieve all Ingredients (Items) and their corresponding quantities for any formula:
Detail Code: INGR – Represents the Item Lines tab.
Field Names: ITEMCODE – Used to retrieve the Item Code (ingredient name), QUANTITY – Used to retrieve the Item Quantity. These are the names for the rows where the value exists.
By using these field names in the function calls, you can extract both the ingredient details and their quantities efficiently.
object[] lines = (object[])ObjProperty("ITEMCODE.INGR", "FORMULA", "", "*", 1L); object[] qty = (object[])ObjProperty("QUANTITY.INGR", "FORMULA", "", "*", 1L);
- Example 7
-
: Retrieve all References and types from any object.
- In this case, the rowKey = * will retrieve all rows of the table in the chosen column(s).
- The data result will be an array unless there are no rows of the table, in case the result will be null in C#.
- REF is the detail code for References referenced in any object.
- propertyName : OBJECTCODE.REF (FIELD_NAME - OBJECTCODE, DTLCODE - REF)
- objSymbol : Empty quotations to resemble current symbol.
- objectKey : Empty quotations to resemble current object key.
- rowkey : *
- keycol : Not Required.
//Retrives all the reference codes as an array of type Object. string[] oRef = (string[])ObjProperty("OBJECTCODE.REF", "", "", "*"); //Retrives all the reference types as an array of type Object. string[] oRefType = (string[])ObjProperty("OBJECTTYPE.REF", "", "", "*"); for (int y = 0; y < oRef.Length; y++) { MessageList($"Referenced {oRefType[y]} is {oRef[y]}"); }
- Example 7.1
-
: Retrieve Reference(s) of any specific type for any object.
-
propertyName : OBJECTCODE.REF (FIELD_NAME - OBJECTCODE, DTLCODE - REF)
- objSymbol : Empty quotations to resemble current symbol.
- objectKey : Empty quotations to resemble object key.
- rowkey : VENDOR
- keycol : R_OBJECT_TYPE
var objCodes = ObjProperty("OBJECTCODE.REF", "", "", "VENDOR", "R_OBJECT_TYPE"); if (objCodes is Array refCodeArray && refCodeArray.Length > 0) { for (int i = 0; i < refCodeArray.Length; i++){ string firstRefCode = refCodeArray.GetValue(i).ToString(); // Use firstRefCode as needed here MessageList($"RefCode: {firstRefCode}"); } } else { MessageList($"The Referenced Object is {objCodes}"); }
-
- Example 8
-
Retrieving values from Extension Table(Matrix).
The syntax of
ObjProperty -> ObjProperty(string propertyName, string objSymbol, string objectKey, string rowkey, string keycol)
- As per our requirement, objSymbol can be any symbol based on requirement and objectKey is the current object on which the workflow is launched. Empty quotations can be used.
- Let's frame the propertyName by following the below process.
- MATRIX is the detail code for Extension Table/Custom Table/Matrix present in any object.
- propertyName : Field<#>.MATRIX.V\DM<Symbol#>
-
The first argument is made up of three parts. Each part tells the system which data to retrieve and from where.
FIELD<#> – FIELD refers to a column name in a data grid (matrix).
The details associated to this data grid can be found in the object specific MATRIX tables in the database.
Example : FS_FORMULAMATRIX_0 resembles first matrix table associated with the formula.
The <#> is a number that tells the system which column to use.
Columns are numbered internally, starting from 1.
Example : FIELD1 → first column, FIELD2 → second column etc.
MATRIX is the name of detail code for Extension Table
V\DM<Symbol#> - This tells the system exactly which Data Matrix table to use.
Data Matrix tables are given internal numbers by the system.
To reference a specific table, use the prefix "V\DM", followed by the symbol name, and then a table number.
The table numbers start at 0.
Example : First table → V\DMProject0, Second table → V\DMProject1 etc.
Note:- To find the correct Data Matrix table number, check the FsDataMatrix table.
- This table shows how many Data Matrix tables exist for each symbol.
- Example
-
The Project symbol, the below table indicates that there are two Data Matrix tables.
TABLE_CODE SYMBOL VIEW_ID DESCRIPTION SAMPLE SHIPMENTS PROJECT 0 Sample Information SAMPLES SHIPPED PROJECT 1 Sample Shipment Info Note: You can use the value in the VIEW_ID column as the table number. First table → V\DMProject0 defines SAMPLE SHIPMENTS table.
- Example 8.1
-
Retrieving all the Values of a column in an Extension Table.
Function Call : This example retrieves all of the values in the 2nd column of the 1st data matrix table.
ObjProperty(@"FIELD2.MATRIX.V\DMPROJECT0", "", "", "*");
- Example 8.2
- Retrieving a Value from an Extension Table.