I was also looking for something similar and couldn't find anything about it in the documentation.
It seems that the canonical way to do it is to combine "let" and "context pass" (->) operators to first define a variable that stores the value you need to use before context is overriden.
I was also looking for something similar and couldn't find anything about it in the documentation.
It seems that the canonical way to do it is to combine "let" and "context pass" (->) operators to first define a variable that stores the value you need to use before context is overriden.
``` 'let(target_ age => $.target_ age)->$ .users. where($ .age=$target_ age)'
EXPRESSION=
cat > context.json <<EOF
{
"users": [
{"name": "toto", "age": 18},
{"name": "tata", "age": 19},
{"name": "titi", "age": 18}
],
"target_age": 18
}
EOF
yaql -d context.json -n "$EXPRESSION"
```