03-06-2023 04:11 PM
I wanted to perform a extend by performing a lookup using the expression library and it is giving me “this.comparator is undefined” error.
Below is my expression Library Content:
{
embedbusinessUnit: x => x.extend({"Demo":this.comparator[0]}),
embedbusinessUnit1: x => x.merge(this.comparator[0]),
"comparator": [
{
"KSCHL": "EPE",
"VKORG": "1000",
"BusinessType": "E",
"KSCHLN": "LPE",
"VKORGN": "1000"
},
{
"KSCHL": "EP0",
"VKORG": "RG",
"BusinessType": "N",
"KSCHLN": "LP0",
"VKORGN": "1000"
}
]
}
When I access the lib.businessUnitExpr.embedbusinessUnit($) gives me a comparator undefined error.
But when I access lib.businessUnitExpr.embedbusinessUnit1($) then it is able to identify the comparator
Any help would be appreciated.
BusinessUnitComparator.expr (382 Bytes)
03-11-2023 04:27 AM
Hi @patan,
Good day, instead of using "this" use "root" 😄
embedbusinessUnit: x => x.extend({"Demo":__root__.comparator[0]}),
embedbusinessUnit1: x => x.merge(this.comparator[0]),
Thanks,
EmEm