Array Iterate

Description

This object is being used to iterate through each element of an existing array.

The name of the object will be used to uniquely identify this array within the app. For info on this behavior read this: https://quantumintegrate.atlassian.net/wiki/spaces/QOR/pages/351830091.


App Builder Object


Source Code

function execute() { const identifierArr = `${nodeName}-array`; const identifierIndex = `${nodeName}-index`; // Setup array if (globalContext[identifierArr] === undefined) { globalContext[identifierArr] = []; } if (globalContext[identifierIndex] === undefined) { globalContext[identifierIndex] = 0; } switch (trigger) { case 0: { // Trigger const index = globalContext[identifierIndex]; const value = globalContext[identifierArr][index]; const endOfList = globalContext[identifierArr].length <= (index + 1); globalContext[identifierIndex] += 1; return [value, index, endOfList]; } case 1: // Set Index globalContext[identifierIndex] = 0; break; default: break; } return []; }

In Ports

Position

Name

Message Type

Description

Position

Name

Message Type

Description

1

Trigger

Trigger

This port is being used to trigger the 'Array Iterate' object.

2

Reset Index

Trigger

This port is being used to reset the index of the 'Array Iterate' object.


Out Ports

Position

Name

Message Type

Description

Position

Name

Message Type

Description

1

Value

String

This port is being used to sequentially send out each value of the 'Array'.

2

Index

String

This port is being used to sequentially send out each index along the value of the 'Array'.

3

End of List

Digital

This port is being used to send out a digital message to confirm the end of the 'Array' has been reached.


Properties

Name

Description

Name

Description

Object Name

The name of the object on the canvas.

Show Code View

The switch to turn on code view for the Code Object.

Duplicate code into custom Code Object