cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic expression library path

Walkback
New Contributor

I have a requirement where I need a path to a parameter within a expression library. I have a number of grouped collections, which have the same parameter name, something like this:

"Search":
{
	"Material": {
		"serverIPAdrress": "198.168.0.25", "localId": "1d524a85-7f01-4341-a923-0cc706478562"
	},
	"Price": {
		"serverIPAdrress": "198.168.0.202", "localId": "b99d7b0e-5d13-4394-bffc-7951df46c292"
	},
	"Customer": {
		"serverIPAdrress": "198.168.2.131", "localId": "98f0c2a3-d96a-400d-b48b-7b4f8752dc4e"
	}
}

I would like to use the Price or Customer, which I have as a input value ($original.searchType) in my mapper, within my expression library path e.g.:

lib.config.Environment[pipe.projectPath.split('/')[1]].Search.$original.searchType.localId

is there a way to include this in my mapping table, to dynamically allow to pass in generic parameters to the next snap?

Thank you

Jay

2 REPLIES 2

bojanvelevski
Valued Contributor

Hi @Walkback,

If I understand correctly, you want to dynamically get the configuration, depending on the input. If that’s correct, than you can use the .get() method:

lib.config.Environment[pipe.projectPath.split('/')[1]].Search.get($original.searchType).localId

Regards,
Bojan

Walkback
New Contributor

Bojan

Perfect, that works, thank you.

Jay