Forum Discussion
Hi @patan,
The problem is occurring because you use brackets inside the function and try to access “comparator” with this keyword which not anymore refers to the root elements, but one scope above, which in this sample is the function scope.
Below is an image of the scopes in your config:
When you tried to access ‘comparator’ from the inside extend function, what happened in the background is that the compiler attempted to search for ‘comparator’ on the 2nd scope, In which didn’t found the element.
If you want to extend the element with a different name from the specified you can use sl.zipObject function. Use this one: x.extend(sl.zipObject(["Demo"],[this.comparator[0]]))
This will work because it is not created a new score.
Regards,
Viktor
@viktor_n Thank you for your response with a detailed explanation.
I wanted to extend only one field/property from the comparator array element based on the matching criteria as shown below:
embedbusinessUnit: x => x.extend({"Demo":this.comparator[0].KSCHLN})
Kinds&Regards
Patan