cancel
Showing results for 
Search instead for 
Did you mean: 

String problem

Former Member
0 Kudos

Hiee..,I have a filed and it has data..,it can hold either numeric or string value..,I want to know whether it has a numeric value or string..,by that I have to do some other requirement

please help..

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks

nikhil_bose
Active Contributor
0 Kudos

you can try parsing the input. If it is not integer, then that is a string.

onAction check input field


String temp = wdContext.currentContextElement().getInputValue();
try{
 int value = Integer.parseInt(temp);
 // you can do rest coding for integer input.
 wdComponentAPI.getMessageManager().reportSuccess("input is integer");
}catch(NumberFormatException e){

 // do coding for string input
wdComponentAPI.getMessageManager().reportSuccess("input is alphanumeric");

nikhiL

RobEricsson
Participant
0 Kudos

I'm not 100% sure what you are asking. But, assuming you are starting with a String field of some kind, you can try to parse it to a number. If you get an exception, then it isn't a number.