01-11-2022 03:57 AM
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
Solved! Go to Solution.
01-11-2022 06:42 AM
Change your responsibleUnit to a function:
"responsibleUnit": (opt) => match opt {
"10" => "Delivery",
"9" => "Operation",
"8" => this.salesRegionMapper('accountableUnit', 8),
"16" => "Tolling Services",
_ => "unknown"
},
Then you can call as a function and it will drilldown to the salesRegionMapper function:
lib.testcall.responsibleUnit('8')
01-11-2022 08:14 AM
Thank you, Kory, that worked perfectly!