Updating an Array with New Records: Recommended Logic Blocks
  • 24 Jan 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Updating an Array with New Records: Recommended Logic Blocks

  • Dark
    Light
  • PDF

Article summary

I need to update an array with new records through a behavior. What are the recommended logic blocks to be used for this requirement?

There are two blocks that can be used to update an array with new records. However, one block is more strongly recommended, and the reasons for preferring it over the other are explained below.

Variable component > Set block

setblock

In the above image, Enrollist is an array where a new record is required to be added. 

How it Works:

The Set block inserts the record directly into the Enrollist array. This method is time-efficient and hence recommended to be used for all scenarios where array needs to be updated.

List component > in list block

inlist-insertblock

In the above image, Enrollist is an array where a new record is required to be added. 

How it works:

  • The block takes a copy of the existing array.
  • It adds the new object into the copy.
  • Finally, it assigns the modified copy back to the original array.

The drawback of this method is that it increases the process time, especially when dealing with large datasets.

Note
While this method achieves the desired result, it is not recommended to be used for large arrays due to the increased processing time.




Was this article helpful?

ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence