Skip to main content

Destructure collection elements in FOR loops

Use destructuring syntax to extract specific properties from collection elements directly in the loop variable declaration. This eliminates the need for property access syntax within the loop body.
Destructuring makes your queries more readable and explicit about which properties are being used in the loop body.
When using the SDKs or curling the endpoint, the query name must match what is defined in the queries.hx file exactly.

Example 1: Basic destructuring

Here’s how to run the query using the SDKs or curl

Example 2: Nested property access with destructuring

Here’s how to run the query using the SDKs or curl

Example 3: Selective field extraction

Here’s how to run the query using the SDKs or curl

Basic FOR Loops

Iterate over collections with simple variable binding

Nested FOR Loops

Use multiple levels of iteration for complex operations