Skip to Content
avatar image
Former Member

Counter from the end of context

Hi friends,

we are looking for a functionality to count/increment from the end of the context.

for example,

we want to increment after "005" in this case & start counting further as 006, 007 etc.

Please share your ideas.....

or even some ideas to capture the last number of context/queue would help us to build the logic further.....

12.png (18.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 20, 2012 at 10:28 PM

    Hi guys,

    Below is the udf to do this functionality,

    public void Queue_counter(String[] BUZEI, ResultList result, Container container) throws StreamTransformationException{

    for (int i=0;i <= BUZEI.length; i++)
      {
      
       if (i == BUZEI.length)
      
       {
       result.addValue(i);

       }
      }

    }

    -santosh.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Santosh,

                           I think this will  work

      public void Queue_counter(String[] BUZEI, ResultList result, Container container) throws StreamTransformationException{   result.addValue(""+BUZEI.length); }

      I feel for loop is not required here.

      Please kindly check if this works.

      regards

      Anupam

  • avatar image
    Former Member
    Sep 23, 2012 at 05:52 PM

    Hi Santosh,

    Anupam is right. No need to take a For loop.

    Logic is very simple.  You can check how many times that filed is populated for which you want to display the context of the counter, (No of times the filed exist +1 ) will be your result. You can create an udf and can apply it to any field.

    Best Regards,

    Sagarika

    Add comment
    10|10000 characters needed characters exceeded