on 08-23-2007 5:15 PM
Hello All,
I wanted to check if a field value is numeric or not. I tried working around with standard XI mapping functions, but could never get it working. Are there any UDF's to check the value if its numeric or not? I tried writing a UDF, but could not get it working.
I appreciate it if someone can give me some pointers.
Thanks
Balu,
Do u want to return boolean value say yes or no based on the numeric value?
12345 - Yes
123AB - No
This what do u want?
-raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This UDF is working with a numeric value. But If there is a Alphanumeric value, it shoud return 0 (zero) right?? Instead its throwing a Runtimre exception .
<b>RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /MBGMCR02/IDOC/E1BP2017_GM_ITEM_CREATE/MOVE_TYPE. The message is: Exception:[java.lang.IllegalArgumentException: Cannot cast 300A to float. ] in class com.sap.aii.mappingtool.flib3.Arithm method div[300A, 300A, com.sap.aii.mappingtool.tf3.rt.Context@1af41af4]</b>> Hi Balu,
>
> Use the follwing UDF which will return if it is
> numeric otherwise return 0
>
>
//write your code here
> int x = 0;
> ry{
> Integer.parseInt(a);
> return a; }
> catch(NumberFormatException e){
> return "0"; }
Vijaya,
Ignore my earlier post. The UDF that you suggested works. Thanks for your help.
Balu
> This UDF is working with a numeric value. But If
> there is a Alphanumeric value, it shoud return 0
> (zero) right?? Instead its throwing a Runtimre
> exception .
>
> <b>RuntimeException in Message-Mapping
> transformation: Runtime exception during processing
> target field mapping
> /MBGMCR02/IDOC/E1BP2017_GM_ITEM_CREATE/MOVE_TYPE. The
> message is:
> Exception:[java.lang.IllegalArgumentException: Cannot
> cast 300A to float. ] in class
> com.sap.aii.mappingtool.flib3.Arithm method div[300A,
> 300A,
> com.sap.aii.mappingtool.tf3.rt.Context@1af41af4]</b>>
> Hi Balu,
> >
> > Use the follwing UDF which will return if it is
> > numeric otherwise return 0
> >
> >
//write your code here
> > int x = 0;
> > ry{
> > Integer.parseInt(a);
> > return a; }
> > catch(NumberFormatException e){
> > return "0"; }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.