Skip to content

Global variable in the iteration #130

@jevvo-trimble

Description

@jevvo-trimble

Hello.
Is there a way (out of the box) to use a global variable in the iteration operators like "some" or another way to create a similar rule?

I need to do this.

Example:
Note: global_var does not exist. Only for demo purposes.

Rule:
{
"some": [
{ "var": "x" },
{ "in": [ { "var" : "" }, { "global_var": "y" }] }
]
}

Data:
{
"x": [1, 2, 3, 4],
"y": [0, 1, 5]
}

First iteration:
{
"some": [
[1, 2, 3, 4],
{ "in": [ 1, [0, 1, 5] ] }
]
}

Second iteration:
{
"some": [
[1, 2, 3, 4],
{ "in": [ 2, [0, 1, 5] ] }
]
}

...

ATM it will work like this (i iteration count)
{
"some": [
{ "var": "x" },
{ "in": [ { "var" : "" }, { "var": "y" }] }
]
}

{
"some": [
{ "var": "x" },
{ "in": [ x[i], x[i].y" ] }
]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions