cancel
Showing results for 
Search instead for 
Did you mean: 

Incrementing the value

Former Member
0 Kudos

Hi,

Iam doing a jdbc-to-jdbc scenario in which one of target table field has to be filled with a number in the following way.

Initially it should have 1 and for every execution of the scenario it should increase by 1 i.e for 2nd time execution it should be 2 like that....

anybody Please help me regarding this.

Thanks & Regards,

Radhika.

Accepted Solutions (1)

Accepted Solutions (1)

prateek
Active Contributor
0 Kudos

When the same payload contains multiple occurrences, then standard functions could be used.

For case where the messages are separate, this needs to be handled at the receiver end itself. Or may be handled in XI using the JDBC lookup

Another option would be to send some indicator from Sender and map accordingly.

Regards,

Prateek

Answers (3)

Answers (3)

Former Member
0 Kudos

Use the folllwoing UDF may help to you:

<b> Increment the Global Variable Counter</b>

public String incrementCounter(String a,Container container){

if(a.equals(" "))

{

Object o = container.getGlobalContainer().getParameter("CNTR");

Integer ii;

if( o == null ) ii = new Integer(0);

else ii = (Integer)o;

ii = new Integer( ii.intValue() + 1);

container.getGlobalContainer().setParameter("CNTR", ii);

String temp = ii.toString();

switch( temp.length() )

{

case 1: temp = "00"+ temp; break;

case 2: temp = "0"+ temp; break;

}

return temp;

}

else return " ";

<b>Intialise the Counter</b>

Object o = container.getGlobalContainer().getParameter("CNTR");

Integer ii = new Integer(0);;

container.getGlobalContainer().setParameter("CNTR", ii);

return "1";

Warm Regards,

Vijay

justin_santhanam
Active Contributor
0 Kudos

Radhika,

Use<b> Counter</b> function.

This sample will help you.

http://flickr.com/photo_zoom.gne?id=1064675164&size=o

http://flickr.com/photo_zoom.gne?id=1064675430&size=o

Best regards,

raj.

agasthuri_doss
Active Contributor
0 Kudos

Hi,

Ther is a function called Increment / Counter it will help

Regards

Agasthuri Doss