on 09-13-2011 10:55 AM
hi all,
i have structure
subject (node)
subject name
marks
this is my source structure iam giving multiple values using duplicate sub tree and i want to add all the given marks for getting the total i want to know which node function is used to achieve this using graphical mapping
thanks in advance
Hi,
You can try the following mapping
marks ------------>removeContexts------------>UDF-------->target field
The UDF is as shown below ( use advanced UDF of type "context")
public void totalMarks(String a[],ResultList result,Container container)
{
String t="";
try
{
int i,sum=0;
for(i=0;i<a.length;++i)
{
sum=sum+ new Integer(a<i>).intValue();
}
t=new Integer(sum).toString();
}
catch(Exception e)
{
e.printStackTrace();
}
result.addValue(t);
}
Hope this helps.
______________________________________________________________________________________________________
One small request from my end. If you feel your questions are being answered properly and correctly, could you please kindly
close down the threads. If threads are closed then we know for sure that solution has worked. Also an user with similar problem can use the solutions posted in the thread in future.
___________________________________________________________________________________________________
regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I guess this will not work with Graphical mapping..I m not Sure abt it
But by writing simple UDF you can achieve this,
Execution type -- All values of Queue
marks as firstparameter
int mark1 =0;
for(int i =0;i<marks.length;i++)
{
mark1 = mark1+marks<i>;
String s = Integer.toString(mark1);
}
resultset.addValue(s);
Try this Once
Edited by: Deepthi Muppasani on Sep 14, 2011 8:17 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use Sum function. You will need to handle the context of input data.
Regards
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.