cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for retrieving Import parameter from Parameterized Mappings

vinoth_s6
Explorer
0 Kudos

Hi All,

I have defined a integer type import parameter and  please advice me how to retrieve the parameter and use it in mapping as source field.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Vinoth,

Use below UDF:


public String getInputParam(String input, Container container) throws StreamTransformationException {

  return Integer.toString(container.getInputParameters().getInt("test"));

  }

Regards,

Praveen.

vinoth_s6
Explorer
0 Kudos

Thanks Praveen.

I've some basic doubts.

1. what is "test" here.

2. My parameter is integer type. Here we are using getString() method. Can you explain how it will work.

former_member182412
Active Contributor
0 Kudos

Hi Vinoth,

  • test is the name of the parameter which you defined in the signature tab.

  • I have given the value for test parameter.

  • The UDF return the parameter value.

Regards,

Praveen.

Regards,

Praveen.

Answers (1)

Answers (1)

engswee
Active Contributor

Here are two other alternatives:-

i) Define a normal input argument, and then pass in a Constant value. In the constant selection, you can choose the defined parameter using the Input help.

ii) Instead of using an input argument, define the input as a Parameter instead to the UDF.

When configuring the UDF, you can double click it to set the Parameter value, and here again you can choose the mapping parameter from the Input help.

With either of these approaches, you can perform a Where Used list on the parameter to know where it is used. If you directly access it using coding via container, you cannot trace a where use on a parameter.

Message was edited by: Eng Swee Yeoh

vinoth_s6
Explorer
0 Kudos

But my Parameter type is INTEGER. So It's not allow me to assign for constant.

engswee
Active Contributor
0 Kudos

If your parameter is an integer, you can't use the Constant approach, you will need to use the second approach using Parameter for the UDF.

engswee
Active Contributor
0 Kudos

With this approach, you can see if a parameter is being actively used in anywhere in the mapping object - there will be a tiny red triangle next to the parameter

And if you try to delete a used parameter, there will be a warning prompt.

This will provide an in-built check should you or some other developer mistakenly delete a parameter.