cancel
Showing results for 
Search instead for 
Did you mean: 

UserDefined Function

Former Member
0 Kudos

Hi All,

can you please clear my doubt, is it posible use UDF(simple or Advance) in another SWCV?.

Thanks in Advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nag,

The user defiend functions(Simple or Advance) cant use in another SoftwareComponentVersion, because when you create a UDF that is stored where you mapped that UDF.

Cheers.

AshokKumar

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

Its not true that we cannot use the UDF in another software component. Mapping class loader allows mapping program to access all classes of the boot class loader and only jar files in the same namespace where this mapping is located.

Therefore you need to implement your function in some static (or not static method) of some java file and pack this class to a jar file.

Then you have 2 options:

- put your jar to the boot class path of the J2EE server

- put this jar to every namespace where you going to use this function.

In the Message Mapping you'll need to create a wrapper for your function and that's a manual process for each mapping.

(OR)

But you can use a workaround to prevent manual creation of similar functions in all mappings. Just create a mapping template that contain all needed functions and then apply this template on each mapping you are working on. Even if your structure is different all functions from your mapping template will be added to the current mapping.

---Satish

henrique_pinto
Active Contributor
0 Kudos

Hey Satish,

even if you can define the main application code in a .jar, you still have a User defined function that performs the calling method. And this UDF really can't be used anywhere else, per se. Of course, you can, as Bhavesh has said, use the same application in other UDFs, but nevertheless, your afirmation that "UDFs can be used in different mappings" is wrong.

The approach of reusing mapping templates works well, though.

Another "cleaner" (but a little harder) workaround is to export .mte file from mapping and copy the UDF reference part into another .mte which should be imported in the target mapping.

Regards,

Henrique.

Former Member
0 Kudos

Pinto,

Yes you are right.

---Satish

Former Member
0 Kudos

Hi,

if you copy your massage-mapping (with the UDF) into the other SWCV, you could use your UDF there.

Regards

Dominic

agasthuri_doss
Active Contributor
0 Kudos

Hi,

As Ahmad said cannot reuse the same UDF.

Regards

Agasthuri Doss

Former Member
0 Kudos

Hi,

No you cannot do it, you need to create one UDF per SWCV that you are using or follow the Bhavesh advice, it seams a good approach.

Cheers,

Ricardo.

Message was edited by:

Ricardo Quintino

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

A solution to this ,

1.Create a SWCV that is the basic SWCV. All other SWCV's will be dependent on this SWCV/

2. Write a Java Class and wrtie the code in a mthod of this java class and import in under the imported archive of the basic SWCV.

3. Next you can now access this class in any uDF in any maping that is dependent on base SWCV.

Regards

Bhavesh

Former Member
0 Kudos

Hey

if u want to reuse the same UDF ,then no u cant use them .

thanx

ahmad