cancel
Showing results for 
Search instead for 
Did you mean: 

IDOC segment counting

Former Member
0 Kudos

Hi Experts,

How to count the IDOC segment if particular field value is "IN".?

Regards

Sara

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

use small UDF.

compare the field value with IN if its IN then increment the count. use for loop and if condition.

output result will be counter value.

chirag

Answers (4)

Answers (4)

former_member537867
Active Contributor
0 Kudos

Hi Sara,

Try to use the following UDF's for increment and initialisation of the counter

Increment the Global Variable Counter

public String incrementCounter(String a,Container container){

//write your code here

if(a.equals("IN"))

{

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();

return temp;

}

else return " ";

Intialise the Counter

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

Integer ii = new Integer(0);;

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

return "1";

Regards,

Vinod.

SudhirT
Active Contributor
0 Kudos

hi sara,

Try this its possible through standard functions

field----->
                  EqualsS----IfWithoutElse------Segment------>then--->COUNT(statistics)---->Target Node
Constant(IN)

Just set the proper context to one level up in parent hierarchy

Thanks!

dharamveer_gaur2
Active Contributor
0 Kudos

Hi

use similar thread for segment count

Count particular field

former_member200962
Active Contributor
0 Kudos

Hi,

Try this link ...a somewhat similar req is discussed here...just dont include the count = count - 3 statement...

Regards,

Abhishek