cancel
Showing results for 
Search instead for 
Did you mean: 

Sequnce Number generation in Message Mapping..

0 Kudos

Hello All,

I am using this thread as a reference for declaring a Counter for unique sequence number generation...

-


-> define a global variable by clicking the JAVA_SECTION_TOOLTIP icon on the design tab of source message type of ur message mapping.

enter the following in the GlobalVariables Section

Integer counter =0;

-> define a user defined function (SeqGen let's say)

write the following code in it.

Integer seq = 0;

GlobalContainer globalContainer = container.getGlobalContainer();

a = globalContainer.getParameter("counter");

seq = globalContainer.getParameter("counter");

seq = seq + 1;

globalContainer.setParameter("counter",seq);

return a;

now use this user defined function (SeqGen)in all ur mappings to the sequence no of ur line items.

-


If u could just elaborate on creation of UDF.. on what are we goin to pass in the variable 'a'... while creating the UDF. ??

Harpreet..!!

Accepted Solutions (0)

Answers (3)

Answers (3)

venky_b
Participant
0 Kudos

Hi,

U can use standard counter function or index function.

Thanks,

Venkatesh

Former Member
0 Kudos

Hi harpeet,

A UDF can be of two types a Simple UDF and Adavnced UDF.

This is a case of a simple UDF,

A simple UDF returns only 1 element as an output.

here 'a' is such an generated output. you can assign this to any numeric filed of ur target stucture

This UDf does not require any input Field from the message.

These functions are known as generating functions.

Hope this explains.

Reward points if useful.

Regards,

Abhishek

former_member859847
Active Contributor
0 Kudos

Hi,

Here 'a' is the return variable.

the udf will genrate a seq num incrementally staring from 1...an d so.

the udf out put(seq num) has to map specified target field.

warm regards

mahesh.