cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO CREATE A GLOBAL USER DEFINED FUNCTION

Former Member
0 Kudos

Hi Expert,

I'd like to know if there is a way to globalize a user defined function?

I'd like to reuse a user defined function (e. g. DeleteLeadingCharacter) in several scenario/SWC instead of recreated it from scratch everytime - Is it possible?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member431549
Contributor
0 Kudos

This functionality is supposed to be coming in PI 7.1, more easily than deploying a jar file to file system.

Answers (6)

Answers (6)

former_member181959
Contributor
0 Kudos

Hi,

You can do that. All that you need to do is, create a class with the function of requried functionality. And create it as archive (.jar or .zip) and import the same in Import Arhives in IR.

So you can use the same function when and as you want.

    • Dont forget to enter import statement refering to the arvhice classes.

Hope this helps.

Prasad Babu.

Former Member
0 Kudos

Hi

There are no global functions.Global variables are possible.

You can use a UDF only in the Message Mapping where you created it.

Also you can create a java UDF and import it as an archive in whichever scenario you want.

Thanks

Former Member
0 Kudos

Hi SALA,

<b>I'd like to reuse a user defined function (e. g. DeleteLeadingCharacter) in several scenario/SWC instead of recreated it from scratch everytime - Is it possible?</b>

its not possible...u have to recreate it.....

u can copy the code and modify only..

i min to say ..suppose u have created one UDF in one Message mapping...u cant reuse it in another Mapping..evenif bothe the mappings are under same namespace.

regards

biplab

Former Member
0 Kudos

NO you cannot not reuse one UDF not even in other namespace even in the same namespace in diff Mapping programme.

UDF is liminted to GraphicalMappingProgramme that you created you cannot reuse it in other MappingProgrammes.

Like your MM =A has function <b>getMyName</b>

you can use it in MM=A but if you want to use it in MM=B then u cannot.

So its not possible in XI or PI.

But it is possible in new release PI 7.1. That says you can write UDF and can reuse in any MM programme.

Thanks

Farooq.

*Rewards Points if you find it useful*

Former Member
0 Kudos

He Farooq,

<b>NO you cannot not reuse one UDF not even in other namespace even in the same namespace in diff Mapping programme.</b>

I guess thats obvious.i have also said that at any case u cant reuse UDFs ..wheather MMs are under same namespace or diff namespace....!!

biplab

Former Member
0 Kudos

Hi SALA

Yes u can define global method by creating a java class

Steps

> create java class with whatever method u want to use again and again

> create JAR file of the java class

> import into impotted archive folder

> and while creating UDF u can use import statement like normal java program

> and access those method in ur code

rewards point if helpfull

prateek
Active Contributor
0 Kudos

<i>I'd like to know if there is a way to globalize a user defined function?</i>

No. A particular variable can be made as global variable

<i>

I'd like to reuse a user defined function (e. g. DeleteLeadingCharacter) in several scenario/SWC instead of recreated it from scratch everytime - Is it possible?</i>

UDF visibility is in the message mapping in which it is created

Regards,

Prateek

former_member189387
Active Contributor
0 Kudos

Hi SALA JEROME ,

We can use Global variables not Global Functions . That too specific to Namespaces .

Regards.,

V.Rangarajan