Utilities Component
  • 27 Mar 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Utilities Component

  • Dark
    Light
  • PDF

Article summary

The Utilities component consists of blocks that perform sorting and grouping actions.

Object Sort

The Object Sort block sorts JSON array data based on the specified sorting type.

InputOutputBlock LayoutGenerated Code

Choose the sorting type: (Ascending, Descending)

 ParamName as a variable or Text-input-1

JSON array data as variable or object data-input-2


Returns Sorted JSON object based on sorting type.


 
JavaScript
__er.sortObject("ascending", 'parameter', obj );

Object GroupBy

The Object GroupBy block groups JSON array data based on the specified parameter.

InputOutputBlock LayoutGenerated Code

Parameter Name as a variable or Text - input-1

JSON array data as variable or object data - input-2


Returns Grouped JSON object.


GroupBy
JavaScript
(__er.groupBy('parameter', obj));

Object(Table) filter

The Object filter block searches within a table variable for records that meet a specified condition and returns those filtered records. 

  • The column given inside the filter condition must be either defined as a Primary key or an indexed column. 
  • You can add multiple filter conditions inside the block. 
  • The operators that can be used in the filter condition are (EQUAL, STARTS_WITH, and IN). 

For example: You have a Details table, with columns Name, Id and Role. You are required to filter the table based on Id, where Id is a user input field. To do this operation the object filter block is used as follows:

InputOutputBlock LayoutGenerated Code
  • Object filter - Select the table name on which the filter condition should be applied
  • Filter Criteria (can apply multiple conditions)
    • Key - column name is the filter criteria
    • Operator - Select the operator
    • Value -  column value

Set -  Select the output table name


object filter-new
async function er_1700464931_click(e,obj,index){
   __er.setState("Details2", await __er.filterObjects("Details",[  {"name": "Id", "condition": "EQ", "value": (await __er.getState("Id")) , "op": "AND", "value_2": ""},]));

Object isExist

The Object isExist block searches within a table variable for records that meet a specified condition and returns the output as a Boolean(True or False) value. If True, the record exists and if False - the record does not exist. 

  • The column given inside the filter condition must either be defined as a Primary key or an indexed column. 
  • You can add multiple filter conditions.
  • The operators that can be used in the filter condition are (EQUAL, STARTS_WITH, and IN).

For example: You have a Details table, with columns Name, Id and Role. You are required to check whether a record exists based on the Id, where Id is a user input field. To do this operation the Object isExist block is used as follows:

InputOutputBlock LayoutGenerated Code
  • Object filter - Select the table name on which the filter condition should be applied
  • Filter Criteria (can apply multiple conditions)
    • Key - column name is the filter criteria
    • Operator - Select the operator
    • Value -  column value

Set -  Select the output variable


objectisexist
async function er_1700541435_click(e,obj,index){
   __er.setState("Boolean", await __er.objectIsExist("Details",[  {"name": "Id", "condition": "EQ", "value": (await __er.getState("Id")) , "op": "AND", "value_2": ""},]));

}



Was this article helpful?

What's Next
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence