cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Match Expression stored in a Variable

TLOY_TGA
New Contributor

I have a Pipeline using in different branches the same Mapper for one of the Field
See ScreenShot
image

I would like to use a Pipeline Variable in my Mapping Expression in order to update/maintain only once my expression

my ORGANISATION Mapping expression looks like this

{match $ORGANISATION {
โ€œH10โ€ => โ€œCC_0001โ€,
โ€œH11โ€ => โ€œCC_0004โ€,
โ€œH12โ€ => โ€œCC_0004โ€,
โ€œH1000โ€ => โ€œCC_0001โ€,
โ€œH1100โ€ => โ€œCC_0002โ€,
โ€ฆ

โ€œโ€ => โ€œCC_ERRORโ€,
_ => $ORGANISATION}}

How is this possible?

Thank you for your answer

6 REPLIES 6

bojanvelevski
Valued Contributor

Hello @TLOY_TGA ,

If all of the marked Mappers are the same, you can use Pipeline Execute. That way you will maintain/update only one Mapper.

Best regards,

Bojan Velevski

del
Contributor III

There are a couple of options I can think of:

  • You can use the eval() function on a parameter to execute the code in the parameter.
    ( ex. eval(_Parm_Expression) )
    But, take notice of the performance note in the documentation.
  • You can create and use an expression library file. There can be a slight learning curve, but for your use case, I think I would choose this option because the size of your expression would probably be easier to read and maintain in a file than in a parameter field.

koryknick
Employee
Employee

Iโ€™m not sure a pipeline parameter would work for this case. I believe an expression file arrow function is the right way to go. Take a look at the following for a starting point. The โ€œstring.exprโ€ gives an example of an arrow function that uses the โ€œmatchโ€ operator.

del
Contributor III

This is not a challengeโ€ฆ just sharing an example ๐Ÿ™‚
Community.9634.slp (3.6 KB)

I believe an expression file arrow function is the right way to go

I agree completely.