Skip to Content
avatar image
Former Member

IDOC segment counting

Hi Experts,

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

Regards

Sara

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 26, 2008 at 11:26 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 26, 2008 at 11:30 AM

    Hi,

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

    Regards,

    Abhishek

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 26, 2008 at 11:32 AM

    Hi

    use similar thread for segment count

    dynamically-count-the-segment-at-the-target

    Count particular field

    udf-to-count-occurance-of-a-particular-field-of-a

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 26, 2008 at 11:51 AM

    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!

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 26, 2008 at 12:27 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded