cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to perform a lookup and extend the object using the expression library

patan
New Contributor III

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)

5 REPLIES 5

alchemiz
Contributor III

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