cancel
Showing results for 
Search instead for 
Did you mean: 

Any Idea to manage the UDF

Former Member
0 Kudos

As far as i know, the UDF cannot be referenced cross the different mapping

so, how to manage the UDF (such as the very common function)

and if i want to change the UDF, i just want to change in the referenced place

i don't want to change the other same UDF

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Another option~

1. Create a Class that will contain the corresponding UDF logic.

2. Create a base Software Componenet and import this Class under the Imported Archives of this Base SWCV.

3. Now , all the other SWCV's should have a Usage Dependency Defined on the Base SWCV.

4. Whenever you want to call this UDF, create a UDF in the graphical mapping that will instantiate the Class in the Base SWCV and then invoke the method.

5. Any change to the logic needs to be done on the Class in the BASE SWCV.

Regards

Bhavesh

Answers (2)

Answers (2)

Former Member
0 Kudos

Leo,

I would suggest to have all the user defined functions in one mapping and create it as a mapping template. Then use this mapping template as your mapping. Here even you can change the message type but still your UDFs will be there. Also you change the UDF according to the requirement for that mapping.

---Satish

justin_santhanam
Active Contributor
0 Kudos

Leo,

First of all Global Variables which we are defining can't be referenced across mapping, I won't think so that UDF can be referenced. Since you said that UDF is common, I won't think so its related to any of the particular nodes, I mean the input parameter of UDF is independent across mappings. So what I would suggest you is write java class and place the class file in the XI mapping folder , I don't know the exact location, if you want i'll try to find it out and let you know. So the common file is there so u can use that functionality across all mappings.

I doesn't know it helps you are not, its just an idea/approach from my point of view.

Best regards,

raj.

Former Member
0 Kudos

aha

Raj Thanks a lot

could you show me the particular file folder?

justin_santhanam
Active Contributor
0 Kudos

Leo,

I'm not sure whether we have to place in the particular XI folder or we have to create jar file and import in the imported archive, and use that class. I think the latter part makes sense, try to create jar file and import and utlize that class.

Best regards,

raj.

Former Member
0 Kudos

Hi Raj,

The above approach of creating jar file will not work for UDF.....you create jar file and import them for JAVA mapping programs and not for UDF........

Hi Leo,

To manage common functions, i suggest you to create a common file having all your common functions in any folder........then in every mapping which you create you can copy-paste the UDF in your mappings........but then you will also have to maintain an excel-sheet to have this information that which UDFs you are using in which mappings................then on changing the UDFs, you will have to copy-paste the latest UDFs in all the mappings...........

Thanks,

Rajeev Gupta

Former Member
0 Kudos

Hi RAJEEV GUPTA

I think that is a good idea

but it's inconvenient to manage the UDF

thank you guys

Former Member
0 Kudos

Raj,

In a similar situation I created a class with several functions that contain the logic for the user-defined functions and imported a jar file containing the class under Imported Archives.

All the user-defined functions only call the functions in this class.

You can even create a separate SWCV which holds the class and make your other SWCVs dependent on it so that you only have to import the jar files containing you UDF class(es) in one place.

Kind regards,

Koen

Former Member
0 Kudos

Hi Leo,

I suggest you to follow the approach bhavesh already told you, it's the same I follow and gives you a wide flexibility in reusing the functions and mantaining the code.

Just to add to what he already said, I would probably declare al the methods of the class as static so that you do not need to instantiate an object inside the UDF but just reference the static method of the class.

Kind Regards,

Sergio

bhavesh_kantilal
Active Contributor
0 Kudos

Koen,

Exactly what i have mentioned as well :-). A solution that has worked very well for us.

Nice to know that this has been implemented else where as well.

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

>

> Just to add to what he already said, I would probably

> declare al the methods of the class as static so that

> you do not need to instantiate an object inside the

> UDF but just reference the static method of the

> class.

Never thought about this. This is what happens when you forget the basics of Java Quite a useful tip Sergio. Thanks!

Regards

Bhavesh