Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Validating BigDecimal

Hello,

I am using an Input field of Big Decimal type. If the user enters characters or anything other, I need to show error image.

Could you please tell, how to validate the bigdecimal?. Thanks.

Former Member
Former Member replied

How you are assigning BigDecimal to InputField? I guess your context attribute is of type string but you want to validate to accept only BigDecimal.

There is no direct InputAction so you should validate on any of the button action:

String bigValue = wdContext.currentContextElement().getBigDecValue();

boolean validValue = true;

BigDecimal bigObj = null;

try

{

bigObj = new BigDecimal(bigValue);

}

catch(NumberFormatException nfe)

{

validValue = false;

wdComponentAPI.getMessageManager().reportException("Invalid value",false);

}

if(validValue)

{

//continue ur logic

}

Regards

AG

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question