Array — Reference
Maintain a reactive page collection with explicit item, index, sorting and update behavior.
Maintain a reactive page collection with explicit item, index, sorting and update behavior.
Before you begin
Section titled “Before you begin”- An App Connect page and a small test array.
A reactive page array
Section titled “A reactive page array”Array keeps items and count in page memory. Its mutation methods update the collection for dependent bindings; they do not persist a database or browser-storage change.
Properties, data and actions
Section titled “Properties, data and actions”| Part | Meaning |
|---|---|
| ID | The component name, for example productsArray. |
| Items | Initial/bound array expression. Changes to a bound source can replace the local items. |
| items / count data | Read productsArray.items for the collection and productsArray.count for its current length. |
| Add / Add Unique | Append one value, with Add Unique checking identity/primitive equality rather than a record’s id property. |
| Insert | Insert the supplied value at the given zero-based index. |
| Insert Before / Insert After | The runtime locates an existing item value and inserts relative to it. The current inspector labels the first argument Index, but it is passed to the item-value lookup; it is not the same as the positional Insert index. |
| Replace / Replace At | Replace finds the old item value; Replace At uses a zero-based position. Both use the supplied new value. |
| Remove / Remove At | Remove finds the first matching item value; Remove At uses a position. An absent value is ignored by Remove. |
| Concat / Concat Unique | Append another array, optionally deduplicating by primitive equality/object identity. This is not a key-based database merge. |
| Flatten / Flatten Unique | Flatten nested arrays to the requested depth, default 1, optionally deduplicating. The current inspector labels the argument Array even though the runtime method expects depth. |
| Reverse | Reverse item order. |
| Sort | The no-argument action uses JavaScript’s default sort, which can be lexical for numbers. The runtime also supports a property path and direction through an expression, such as productsArray.sort('price', 'desc'). The simple inspector exposes no fields for those arguments. |
| Randomize | Shuffle item order. Do not use this UI helper as a cryptographic randomness source. |
| Empty | Set items to an empty array and count to zero. |
| updated event | Signals an actual change to the collection data. |
Worked example
Section titled “Worked example”Start with items [“Notebook”,“Pencil”]. Add Backpack and confirm count 3. Remove At index 1 and confirm items [“Notebook”,“Backpack”]. Then try an object array with price fields and sort by price through the explicit runtime expression; verify the resulting record order.
Keep values and positions separate
Section titled “Keep values and positions separate”Value-based methods use primitive equality or object identity, not deep equality or a chosen id field. Positional methods use JavaScript array-splice semantics; validate non-negative indices below the intended bounds. A new bound Items value can replace local edits. Use a server workflow for durable changes.
Render or persist the result
Section titled “Render or persist the result”Bind a repeat to productsArray.items when displaying the array. Use a storage manager or server action explicitly if it must outlive this page.
Check your result
Section titled “Check your result”You can choose the correct mutation method, bind items/count, and check value-versus-index and sorting behavior.