on 04-03-2007 3:34 PM
Hi,
Information Line 1:
IF E1IDB02 BA-FIIKWAER = CNY
then MID(E1EDKA1 BE-NAME1,12,11)
IF E1IDB02 BA-FIIKWAER <> CNY and LEN(E1EDKA1 BE-NAME1)<=35
then MID(E1EDKA1 BE-STRAS,1,35)
IF E1IDB02 BA-FIIKWAER <> CNY and LEN(E1EDKA1 BE-NAME1)>35
then MID(E1EDKA1 BE-NAME1,36,35)
MID(E1EDKA1 BE-NAME1,12,11), If the total lenght NAME1 is ManoJ Kumar Musunuri and the the request is to pick the string from 11 to 22 lenghs, But the defined value is give is less than 22 lenght.
In these cases the a run time exception error is given. So my understanding is that the other total lenth of the field(ie.., 35characters) has to be entered atleast with spaces.
I would like to know if you have solution for this. Else we need to create a user defined function.
Manoj
Hi,
Yes, but you have to write your own UDF ,
but i can give example use this to solve your problem.
IF E1IDB02 BA-FIIKWAER = CNY
then MID(E1EDKA1 BE-NAME1,12,11)
1)
input E1EDKA1 BE-NAME1,E1IDB02 BA-FIIKWAER
<i>if (E1IDB02 BA-FIIKWAER = CNY) {
return substring(E1EDKA1 BE-NAME1,12,11);
}</i>
2)
input E1EDKA1 BE-NAME1,E1IDB02 BA-FIIKWAER
IF (E1IDB02 BA-FIIKWAER <> CNY ) && ( (E1EDKA1 BE-NAME1).length<=35)
{
return substring(E1EDKA1 BE-STRAS,1,35);
}
3)
IF (E1IDB02 BA-FIIKWAER <> CNY) && ((E1EDKA1 BE-NAME1).length>35)
{
return substring(E1EDKA1 BE-NAME1,36,35);
}
Regards
Chilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Manoj,
or u can use this simple java function..
//specify the location on the string u want to cut from
int start = 1;
//specify the location on the string u want to cut to
int end = 4;
//"aString is the string you want to cut.
String substr = "aString".substring(start, end);
public class subStringer(){
//main method
public static void main(){
int start = 4;
int end = 8
String cutMe = "kingKongRuledTheWorldWithDinosaurs ";
String choppedString = cutMe.subString(start, end);
System.out.println(choppedString);
}//end main
}
The above program should give an output of "Kong"
Hope that helps..
Regards
Ravi
Hi,
Use UDF , it is the best option.
use substring java function to get it.
Regards
Chilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.