Skip to content

Record Data Table

Overview

Data table related functions

getById

Returns the queried data table record information

javascript
Record.getById(tableId, recordId);
ParameterTypeDescription
tableIdStringData table identifier
recordIdStringRecord ID

Return Value

Type Object Data table record information, returns null if it doesn't exist

Example

javascript
Record.getById("order", "z2koxrkxtp854"); //{amount=11, name=Test Purchase Order, id=z2koxrkxtp854}

getFieldValue

Returns the field value of the data table record

javascript
Record.getFieldValue(tableId, recordId, fieldId);
ParameterTypeDescription
tableIdStringData table identifier
recordIdStringRecord ID
fieldIdStringField identifier

Return Value

Type Object Field value of the data table record, returns null if the record doesn't exist, returns null if the attribute doesn't exist. Throws an exception if the data table doesn't exist

Example

javascript
//{amount=11, name=Test Purchase Order, id=z2koxrkxtp854}
Record.getFieldValue("order", "z2koxrkxtp854", "amount"); //11

getByField

Filter data table record list based on a single field

javascript
Record.getByField(tableId, fieldId, opt, value);
ParameterTypeDescription
tableIdStringData table identifier
fieldIdStringField to filter by
optStringOperator, see ConditionOpt for details
valueObjectFilter condition value

Return Value

Type Array<Record> Returns the list of records that meet the conditions, up to 10,000 records. Returns an empty array if no data meets the conditions. Throws an exception if the data table doesn't exist

Example

javascript
//{amount=11, name=Test Purchase Order, id=z2koxrkxtp854}
Record.getByField("order", "amount", "eq", 11); //[{amount=11, name=Test Purchase Order, id=z2koxrkxtp854}]

getByFields

Filter data table record list based on multiple fields

javascript
Record.getByFields(tableId, conditions);
ParameterTypeDescription
tableIdStringData table identifier
conditionsArrayFilter conditions, see Condition for details

Return Value

Type Array<Record> Returns the list of records that meet the conditions, up to 10,000 records. Returns an empty array if no data meets the conditions. Throws an exception if the data table doesn't exist

Example

javascript
//{amount=11, text=13, id=z2koxrkxtp854}
Record.getByFields("tab", [{ fieldId: "text", opt: "eq", value: "13" }]); //[{amount=11, text=13, id=z2koxrkxtp854}]

getRecordOptionName

Returns the name of a single option value

javascript
Record.getRecordOptionName(tableId, fieldId, value);
ParameterTypeDescription
tableIdStringData table identifier
fieldIdStringField identifier
valueStringOption value

Return Value

Type String Returns the name of the option value, returns the input option value if it doesn't exist in the option list Throws an exception if the data table doesn't exist

Example

javascript
//Option list: a:'Option 1', b:'Option 2'
//{amount=11, name=Test Purchase Order, id=z2koxrkxtp854, type=a}
Record.getRecordOptionName("order", "type", "a"); //Option 1
Record.getRecordOptionName("order", "type", "c"); //c

getRecordOptionNames

Returns the names of multiple option values concatenated together

javascript
Record.getRecordOptionNames(tableId, fieldId, valueList, join);
ParameterTypeDescription
tableIdStringData table identifier
fieldIdStringField identifier
valueListArray<String>Option value list
joinStringConcatenation string

Return Value

Type String Returns the concatenated names of option values, uses option values for concatenation if they don't exist in the option list. Throws an exception if the data table doesn't exist

Example

javascript
//Option list: a:'Option 1', b:'Option 2'
//{amount=11, name=Test Purchase Order, id=z2koxrkxtp854, type=a}
Record.getRecordOptionNames("order", "type", ["a", "b"], ","); //Option 1,Option 2
Record.getRecordOptionNames("order", "type", ["a", "b", "c"], ","); //Option 1,Option 2,c

getRecordOptions

Returns the option value list

javascript
Record.getRecordOptions(tableId, fieldId);
ParameterTypeDescription
tableIdStringData table identifier
fieldIdStringField identifier

Return Value

Type Array<Option> Returns the option value list, returns null if the field is not List Selection, Tree Selection, or Cascading Selection. Throws an exception if the data table doesn't exist

Example

javascript
//Option list: a:'Option 1', b:'Option 2'
Record.getRecordOptions("order", "type"); //[{id:'a',name:'Option 1'},{id:'b',name:'Option 2'}]

getRelationList

Returns the value of the query's data table relation list field

javascript
Record.getRelationList(tableId, fieldId, recordId);
ParameterTypeDescription
tableIdStringData table identifier
fieldIdStringField identifier
recordIdStringRecord ID

Return Value

Type Array<Record> Returns the value of the relation list, returns an empty array if the field is not a Relation List. Throws an exception if the data table doesn't exist

Example

javascript
Record.getRelationList("order", "orderDetail", "z2koxrkxtp854");