on 07-22-2008 6:20 AM
hai,
iam in need of converting a " string set" in a idoc to a boolean type . is there any simple procedure in graphical mapping to do this ?
Hi Vivek,
You want to convert to boolean to check it in a condition?
e.g,., if (StringSet)
Thanks,
Swapna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vivek,
If your requirement is just to map string value (containing true or false as values) to a output field of type boolean.
In Graphical Mapping, just map the source field directly to target field.No Conversion is needed and it works.
Stringvalue -> TargetField
Thanks,
Swapna.
Edited by: Swapna Seelam on Jul 22, 2008 8:35 AM
Hi Vivek,
From your query, I was of the impression that you are getting true or false as values and you need to convert to boolean.
If it is a real-time scenario with users having an opton to enter their text, then even to use a UDF, you need to know what all are the possible ways the user can send a true value (true, yes, correct,right).A little fast then may be even just 'S' :).
And just one info Boolean.parseBoolean(strName); it does return boolean value, but for UDF the return type is String, so you do not need this. You just have to get the list of possible values and then say
if(String.equalsIgnoreCase("true") || String.equalsIgnoreCase("yes") )
{
return "true";
}
or may be even value-mapping.
Thanks,
Swapna.
Edited by: Swapna Seelam on Jul 22, 2008 1:33 PM
Edited by: Swapna Seelam on Jul 22, 2008 1:36 PM
In UDF of graphical mapping, u may use the following code:
String strName = "true";
Boolean bool=new Boolean(strName);
boolean b=bool.booleanValue();
OR
boolean b = Boolean.parseBoolean(strName);
System.out.println (b);
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well you can use a java code to achieve the same, but I am not sure as to what exactly your requirement is. The reason being the UDF will eventually output a string only.
String str;
boolean b;
b=Boolean.parseBoolean(str);
// Do your validations with b and then finally return a string
String finalStr = new Boolean(b).toString();
BR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.