Skip to Content
0
Dec 03, 2003 at 12:36 PM

A simple counter for mapping

66 Views

Hello Everybody,

You may want to put a counter in your mapping results. I hope this make a clue for your need.

Create a Simple Function as a User-Defined function. Give a name, a description and one input parameter. Your function should like as follows:

public String Counter(String a, Container container) {

String count;

Object counter;

counter = container.getParameter("count");

if (counter == null) {

count = "1";

else {

count = counter.toString();

int i = Integer.valueOf(count).intValue();

i++;

count = Integer.toString(i);

}

container.setParameter("count", count);

return count;

}

You have to set an item in an array as an input parameter. Then you will have an incremental output for each occurence.

Enjoy XI!

Ibrahim