List Component
  • 13 Feb 2023
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

List Component

  • Dark
    Light
  • PDF

Article summary

The List Component comprises of blocks that perform operations related to Lists. 

Create List

This block is used to create a series of list items within a list. It is very similar to the declaration of arrays.

InputOutputBlock LayoutGenerated Code

Add value of any type.


Click the settings icon to add more value blocks or to remove any value block


Returns the list of all the input values


Create
Create-list-addblock
[null, null, null];

Length of the List

This block is used to identify the length of a particular list.

InputOutputBlock LayoutGenerated Code

Variable or list value


Returns the length of the list items.


Length
[].length

List Find Value

It is used to find a particular item from a list of values. The first or last occurrence of the item within a list is identified in this block.

InputOutputBlock LayoutGenerated Code

Variable or list value - input-1 

Choose the type of search 

The variable or value to be searched - input-2


Returns the index of the input-2 occurrence in input-1 based on choice.


 
list.indexOf('') 

list.lastIndexOf('') 

 List Get Value

This block is used to fetch a particular value or object from an array. This is done using the GET function. Additionally, there is another option to 'Get and Remove' the list item once it is fetched. 

The list item can be fetched from the index of #, # from end, first item, last item, or randomly. 

InputOutputBlock LayoutGenerated Code

Variable or list value for input-1 

Choose the get or remove type from the dropdown list, 

Choose the get index type from dropdown list,

Variable or number for the index input-2.


Get or remove the value of input-2 in the given array (input-1) based on choice.



list[0]

list.splice(0, 1)[0]

list.splice(0, 1)

List Set or Insert Value

This block is used to replace any value or object in a given array at the specified location when set is selected in the dropdown list. If insert at is selected, it inserts any value in a list at the specified location. 

InputOutputBlock LayoutGenerated Code

Variable or list value for input-1 

Choose the set type from the dropdown list-1, 

Choose the set index type from the dropdown list-2, 

Variable or number for the index-input-2, 

Variable or value to store- input-3.


Store the value to the given input-3 to the list (input-1)based on choice and input-2.


  
Note
When the index type is set to 'last', the insert at type appends a new row or updates an existing row based on primary key of the table variable(in list).

 list[0] = '';

SubList

This block is used to fetch a sublist from a list. It is similar Array Slicing. It specifies a range of values that need to be returned from the List. 

InputOutputBlock LayoutGenerated Code

Variable or list value for input-1 

Choose the set index type from the dropdown list-1, 

Variable or number for the index input-2, 

Choose the set index type, from the dropdown list-2 

Variable or number for the index input-3.


Returns the sub list from input-1 based on the choice, from input-2 to input-3.


   
list.slice(0, 1);

List to Text

This block is used to convert list items into a series of texts separated by a delimiter. It splits the list items based on predefined conditions and displays the parameters as output text. 

InputOutputBlock Layout Generated Code

Choose the type from the dropdown list: (list from the text - converts Text to list based on the delimiter, text from the list - converts list to text based on delimiter), 

Variable or list or text value for input-1, 

Variable or text delimiter for input-2.


Returns list or text based on choice using given list or text in input-1 and delimiter in input-2.


 
''.split(',');

[].join(',';

Empty List Check

This block is used to check if a particular list is empty. It verifies the length of the list and returns a boolean output.

InputOutputBlock LayoutGenerated Code

Variable or list value for the input

Returns boolean (true or false) based on the input list length


Isempty
![].length

 


Was this article helpful?

ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence