on 08-20-2007 4:07 PM
Hi Experts,
Please refer following code:
for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){
wdContext.nodeWorklist().setLeadSelection(i);
categoryElement = wdContext.createCategoriesElement();
category_1Element = wdContext.createCategories_1Element();
wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();
sum_hrs = wdContext.currentWorklistElement().getSum_Hours();
sum_hrs = sum_hrs.replaceAll(",",".");
if( sum_hrs != null && sum_hrs.trim().length()>0)
d = Double.parseDouble(sum_hrs) ;
d1 = d + 0;
categoryElement.setCategoryText(wbs);
categoryElement.setSeries1Value(d);
category_1Element.setSeries1Value(d1);
wdContext.nodeCategories().addElement(categoryElement);
wdContext.nodeCategories_1().addElement(category_1Element);
wbs = "";
}
I have to find summation of sum_hrs. I don't know how to go about it. I have tried using following line. However it is not working.
d1 = d + 0;
Suppose wdContext.nodeWorklist().size() = 4. In this case the loop will executed four times. Suppose in four cases sum_hrs are 2,3,5 and 2. I have to find the summation of 235+2 = 12.
Can you please help me in modifying the code in such a way that 235+2 = 12 operation is getting executed.
Thanks,
S
Hi Stuart,
please, try this:
sumValue = 0;
for (......)
{
.....
actualValue = Double.parseDouble(sum_hrs) ;
sumValue = sumValue + actualValue;
.....
}
sumValue will contain the sum of all numbers.
Hope this help you.
Vito
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Please check following code.
for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){
wdContext.nodeWorklist().setLeadSelection(i);
categoryElement = wdContext.createCategoriesElement();
double finalSum =0.0;
category_1Element = wdContext.createCategories_1Element();
wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();
sum_hrs = wdContext.currentWorklistElement().getSum_Hours();
sum_hrs = sum_hrs.replaceAll(",",".");
if( sum_hrs != null && sum_hrs.trim().length()>0)
d = Double.parseDouble(sum_hrs) ;
finalSum=finalSum+d;
categoryElement.setCategoryText(wbs);
categoryElement.setSeries1Value(d);
category_1Element.setSeries1Value(d1);
wdContext.nodeCategories().addElement(categoryElement);
wdContext.nodeCategories_1().addElement(category_1Element);
wbs = "";
}
Ashutosh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
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.