Record Data Table
Overview
Data table related functions
getById
Returns the queried data table record information
Record.getById(tableId, recordId);| Parameter | Type | Description |
|---|---|---|
| tableId | String | Data table identifier |
| recordId | String | Record ID |
Return Value
Type Object Data table record information, returns null if it doesn't exist
Example
Record.getById("order", "z2koxrkxtp854"); //{amount=11, name=Test Purchase Order, id=z2koxrkxtp854}getFieldValue
Returns the field value of the data table record
Record.getFieldValue(tableId, recordId, fieldId);| Parameter | Type | Description |
|---|---|---|
| tableId | String | Data table identifier |
| recordId | String | Record ID |
| fieldId | String | Field 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
//{amount=11, name=Test Purchase Order, id=z2koxrkxtp854}
Record.getFieldValue("order", "z2koxrkxtp854", "amount"); //11getByField
Filter data table record list based on a single field
Record.getByField(tableId, fieldId, opt, value);| Parameter | Type | Description |
|---|---|---|
| tableId | String | Data table identifier |
| fieldId | String | Field to filter by |
| opt | String | Operator, see ConditionOpt for details |
| value | Object | Filter 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
//{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
Record.getByFields(tableId, conditions);| Parameter | Type | Description |
|---|---|---|
| tableId | String | Data table identifier |
| conditions | Array | Filter 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
//{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
Record.getRecordOptionName(tableId, fieldId, value);| Parameter | Type | Description |
|---|---|---|
| tableId | String | Data table identifier |
| fieldId | String | Field identifier |
| value | String | Option 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
//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"); //cgetRecordOptionNames
Returns the names of multiple option values concatenated together
Record.getRecordOptionNames(tableId, fieldId, valueList, join);| Parameter | Type | Description |
|---|---|---|
| tableId | String | Data table identifier |
| fieldId | String | Field identifier |
| valueList | Array<String> | Option value list |
| join | String | Concatenation 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
//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,cgetRecordOptions
Returns the option value list
Record.getRecordOptions(tableId, fieldId);| Parameter | Type | Description |
|---|---|---|
| tableId | String | Data table identifier |
| fieldId | String | Field 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
//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
Record.getRelationList(tableId, fieldId, recordId);| Parameter | Type | Description |
|---|---|---|
| tableId | String | Data table identifier |
| fieldId | String | Field identifier |
| recordId | String | Record 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
Record.getRelationList("order", "orderDetail", "z2koxrkxtp854");
