-
Notifications
You must be signed in to change notification settings - Fork 265
Open
Description
Let's consider the following input:
{
"equipments": [
{
"type": "Type A",
"name": "Name A"
},
{
"type": "Type A",
"name": "Name A2"
},
{
"type": "Type B",
"name": "Name B"
}
],
"data": [
{
"id": "0001",
"equipmentName": "Name A"
},
{
"id": "0001",
"equipmentName": "Name A2",
"value": 1
},
{
"id": "0001",
"equipmentName": "Name B",
"value": 2
},
{
"id": "0002",
"equipmentName": "Name A",
"value": 3
},
{
"id": "0003",
"equipmentName": "Name A2",
"value": 3
}
]
}and the following Jsonata:
equipments@$equipments.data
[$equipments.type = "Type A" and $equipments.name = equipmentName] {
id: {
"equipmentNames": equipmentName[]
}
}
which correctly results in
{
"0001": {
"equipmentNames": [
"Name A",
"Name A2"
]
},
"0002": {
"equipmentNames": [
"Name A"
]
},
"0003": {
"equipmentNames": [
"Name A2"
]
}
}Now the issue is, if:
- in the input
equipmentsis empty or does not exist - or
datais empty or does not exist - or the filter
[ ... ](e.g. by changing"Type A"into"Type C") returns an empty result
then the following error is thrown:
can't access property "@", c is undefined
It looks like a bug since the error message is not clear about what I did wrong.
I could add a . after the filter but this changes the result and messes up the grouping:
equipments@$equipments.data
[$equipments.type = "Type A" and $equipments.name = equipmentName]. {
id: {
"equipmentNames": equipmentName[]
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels