Forum Discussion

Henchway's avatar
Henchway
Contributor
4 years ago
Solved

Expression Library evaluates to ArrowFunction

Hello,

i’m trying to nest a function in a map within an expression library, however what i get returned just the ‘callstack’ of the function.

Here’s the outcome:

[
{
"test":
"/* ArrowFunction @ line 5:10 */ () => __parent__.salesRegionMapper('accountableUnit', 8)"
}
]

The expression library is called like this:

lib.map.responsibleUnit['8']

Here is the expression library:

{
	"responsibleUnit": {
	   "10": "Delivery",
	   "9": "Operation",
	   "8" : () => __parent__.salesRegionMapper('accountableUnit', 8),
	   "16": "Tolling Services"
	   },
    "accountableUnit": [
	   [5, "Sales APAC"],
	   [7, "Sales EMENA"],
	   [8, "Sales EMENA"],
	   [19, "Sales LAM"],
	   [20, "Sales NAM"],
	   [21, "Sales Africa"],
	   [22, "Sales EMENA"],
	   [23, "Other"],
	   [24, "Sales EMENA"],
	   [37, "Tolling Services"],
	   [39, "Other"]   
	],
    salesRegionMapper: (mappingTable, value) => this[mappingTable].find(x => x[0] == value)[1],
}

How can i get the function to actually execute and not just be ‘listed’?

Best regards
Thomas