cancel
Showing results for 
Search instead for 
Did you mean: 

Null Check while passing Values to Context from UI

debasish_panda
Explorer
0 Kudos

Hi All,

I am having around 10 Input fields in the UI from which any no of fields can be filled and sent to back end for a search. Where, none of the fields are mandatory. While sending to back end through Context, i want to pass each one of them as an uppercase String.

Is there any way to avoid Null pointer Exception by using TOUPPER method in this case.

Please Let me know all possible solutions for this Situation..

Thanking in advance,

Debasish

Accepted Solutions (0)

Answers (2)

Answers (2)

debasish_panda
Explorer
0 Kudos

Hi All,

Thanks for your Valuable suggestions.

Regards,

Debasish

Former Member
0 Kudos

hi Debashish,

what you can do is pass the values as, wdcontext.currentContextElement().get<yourinputfieldattribute>().toUpperCase();

regards,

rahul

Former Member
0 Kudos

Before converting to the uppercase check to see that it is not null.

String value = wdContext.currentContextElement().getAttributeAsText("<AtributeName>");
//Statement suggested by Rahul also works here.
if(value != null)
 String  upperCaseValue = value.toUpperCase();