Skip to content

Array — Reference

Reference · Advanced · App Connect

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.

  • An App Connect page and a small test 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.

Part Meaning
IDThe component name, for example productsArray.
ItemsInitial/bound array expression. Changes to a bound source can replace the local items.
items / count dataRead productsArray.items for the collection and productsArray.count for its current length.
Add / Add UniqueAppend one value, with Add Unique checking identity/primitive equality rather than a record’s id property.
InsertInsert the supplied value at the given zero-based index.
Insert Before / Insert AfterThe 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 AtReplace finds the old item value; Replace At uses a zero-based position. Both use the supplied new value.
Remove / Remove AtRemove finds the first matching item value; Remove At uses a position. An absent value is ignored by Remove.
Concat / Concat UniqueAppend another array, optionally deduplicating by primitive equality/object identity. This is not a key-based database merge.
Flatten / Flatten UniqueFlatten nested arrays to the requested depth, default 1, optionally deduplicating. The current inspector labels the argument Array even though the runtime method expects depth.
ReverseReverse item order.
SortThe 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.
RandomizeShuffle item order. Do not use this UI helper as a cryptographic randomness source.
EmptySet items to an empty array and count to zero.
updated eventSignals an actual change to the collection data.

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.

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.

Bind a repeat to productsArray.items when displaying the array. Use a storage manager or server action explicitly if it must outlive this page.

You can choose the correct mutation method, bind items/count, and check value-versus-index and sorting behavior.