on 08-08-2007 9:55 AM
Hey, trying to map following structures:
message
-m1
--m11
-m2
--m22
-m3
--m33
to
message
-m1
--m11
-m2
--m22
-m3
--m33
-f1
--countItems
The nodes m1,m2 and m3 can appear 1..unbounded. In target structure I would
like to have the numbers of all nodes (m1,m2,m3).
For example: In this source structure m1,m2,m3 appear only one time. In the
field countItems I would like to have the number 3.
I tried the count function, but it could only count the structure where I used it (in
this case: f1).
How can I count the above-mentioned nodes?
thanks
chris
hi,
map like this..
m1--count---\
ADD----\
m2--count-/ ADDcountitems(f1)
m3-count--/
remember u have to give the context of m1,m2,m3 to root node..
hope this helpful...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi christian u have to use count function of (Statistic) in graphical mapping...
it ill work ....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi christian did u understand...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
map like this....
m1--count---\
ADD----
\
m2--count-/ ADD----countietms(f1)
m3---count----/
remember .....u have to make the context of m1,m2,m3 to root node...
hope this helpful...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use can do the same with Global counters.Here a is the dummy parameter means you can inster this UDF wherever you want to add the counter
<b>To add the counter for each element use the folloing UDF logic</b>
public String incrementCounter(String a,Container container){
//write your code here
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();
return temp;
}
else return " ";
<b>To initialise the counter follow the following UDF logic:</b>
//write your code here
Object o = container.getGlobalContainer().getParameter("CNTR");
Integer ii = new Integer(0);;
container.getGlobalContainer().setParameter("CNTR", ii);
return "1";
Message was edited by:
Gangisetty Vijaya Bhaskarudu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christian Riekenberg ,
You use three Count functions for Three M1,M2,M3 , ( Context should be root ) then sum all the theree count values and store in The Target Countimes fileds.
Regards.,
V.Rangarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use the count function on m1, m2, and m3 and add them together using the add function.
You will have to use the add function twice like this:
add( add(count(m1), count(m2)), count(m3))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
thanks for your answers.
But I still couldn't understand how to do this. I open the message mapping for field f1, but the count function could only be set on an target-element, so where to set the counters for m1,m2,m3? Do I have to insert extra fields under m1..m3?
If I do the counter would increment with every node, so if I have two times m1, in second tree of m1 a two will be insert. If I use the add function, only for these two tree the result would be three!
@Gangisetty Vijaya Bhaskarudu
Is this just one UDF? From where he knows, which nodes he have to count, if I have more than m1..m3, but only want to count this three?
@ sasitharan
same problem as mentioned above:
this doesn't work:
m1--count---\
I can't use m1 as input for count! Or do I have a wrong count function?
<b>....au damm, answered my own question. Of course. I use COUNTER and you use
COUNT!!!!!!!!!!!! I will try this with COUNT!!</b>
thanks
chris
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.