Skip to content

Multiple Extraction #3

Description

@GregYannes

Currently our extraction functions accept scalar indices: each is either a numeric position or a textual key. They also return a single Variant.

Dim i As Variant: i = Array(3, "field_1", 5)

Index x, i

However, we might define an IndexAll() which accepts an array (or even Collection) of scalars as a valid index. When IndexAll() encounters this index, it iterates over each scalar and indexes deeper from there, and finally it returns (say) a Collection with all the results.

Warning

This will be tricky with multidimensional arrays, where such an index must somehow iterate over a particular dimension of that array.

This let us programmatically extract a set of values. For example, this call should yield $2 \times 1 \times 3 = 6$ results.

i = Array( _
	Array(3, 4), _
	"field_1", _
	Array(5, "subfield_2", 7) _
)

IndexAll x, i

We might also permit the scalar True as an index, which tells IndexAll() to iterate over all elements in the current structure, rather than an explicit subset of its elements as specified by an array.

i = Array( _
	Array(3, 4), _
	"field_1", _
	True _
)

IndexAll x, i

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions