on 03-27-2008 3:59 AM
Hi Gurus,
One Quick question here. I have 3 fields of type BigDecimal. How can i programatically add all these 3 fields together and later display this value in a new field? Thanks in advance
hi,
if you node structure is:
biddecimal
1.anum
2.bnum
3.cnum
and result is "result"
public void onActionadd(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionadd(ServerEvent)
BigDecimal val1 = new BigDecimal(wdContext.currentBigdecimalElement().getAnum());
BigDecimal val2 = new BigDecimal(wdContext.currentBigdecimalElement().getBnum());
BigDecimal val3 = new BigDecimal(wdContext.currentBigdecimalElement().getCnum());
// by using th emthod add, we can add decimal numbers
*result1 = val1.add(val2);*
result2 = result1.add(val3);
wdContext.currentBigdecimalElement().setResult(result2.toString());
//@@end
}
regards,
pinki
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
If ur problem has solved ,make the question has solved.
Regards
Hazrath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
1)u can convert the BigDemial value into int or float or double by using the
intValue() or floatValue() or doubleValue()
2)then u can add the 3 values
Regards
Hazrath
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 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.