on 07-15-2008 10:14 AM
Hi,
I want UDF for getting all the values in a context in a single string each value separated by semi-colen.Iam using the following UDF for that :
public void seperator(String[] a[[]],ResultList result,Container container){
//write your code here
String target="";
for(int i = 0;i<a.length;i++)
target = target+a<i>;
if ( ! i == a.length-1)
{
// if i not equal to a.length -1
target = target+";";
}
result.addValue(target);
}
But it is throwing the syntax error
Source code has syntax error: /usr/sap/YXD/DVEBMGS52/j2ee/cluster/server0/./temp/classpath_resolver/Mapffe57490524d11dd9c650014c2650023/source/com/sap/xi/tf/_Mapping name_.java:610: ']' expected public void seperator$(String[] a[[]],ResultList result,Container container){ ^ /usr/sap/YXD/DVEBMGS52/j2ee/cluster/server0/./temp/classpath_resolver/Mapffe57490524d11dd9c650014c2650023/source/com/sap/xi/tf/Mapping namejava:627: ')' expected } ^
Plz help me on this.Its urgent
Hi,
I have done sme thing in my project. here is the UDF.
public void ConcatAllOptions(String[] option,ResultList result,Container container){
String output = "" ;
for( int i = 0; i< option.length; i++ )
{
output = output + option<i>;
if ( i != option.length - 1 )
{
output = output + "," ;
}
}
result.addValue(output);
let me know if you face any difficulty.
Regards,
Sarvesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes..Its working fine now.........changed output = output + option as output = output + option[<i>]
Thanks All
Edited by: nagarjuna _s on Jul 16, 2008 10:56 AM
Edited by: nagarjuna _s on Jul 16, 2008 10:56 AM
Edited by: nagarjuna _s on Jul 16, 2008 10:58 AM
Edited by: nagarjuna _s on Jul 16, 2008 10:58 AM
Edited by: nagarjuna _s on Jul 16, 2008 10:59 AM
Edited by: nagarjuna _s on Jul 16, 2008 11:01 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I want the multiple values(email address) in the context should should come as one string with seperator as semi-colen.
The UDF provided by sarvesh has been doing this.But the problem is...instead of getting those values that i have passed it is showing like this-
[Ljava.lang.string;@6a1b33cb; [Ljava.lang.string;@6f2f27d1;
Please help on this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This is working fine..
public void concat(String[] a,ResultList result,Container container)
{
String output = "" ;
for( int i = 0; i< a.length; i++ )
{
output = output + a<i>;
if (!( i ==a.length - 1 ))
{
output = output+";";
}
}
result.addValue(output);
pls modify stmt as specified by gabriel
but change the context of source node to higher level..
Edited by: malini balasubramaniam on Jul 16, 2008 8:20 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check this..it's working fine..
While creating UDF use the option value
public String check(String a,Container container)
{
//write your code here
String target = "";
int i;
for( i = 0; i<a.length(); i++)
{
target = target + a;
if (!(i == (a.length()-1)))
{
target = target + ';' ;
}
}
return target;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No...it is showing the same thing without that special char.Is there any thing to modify in UDF...?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use the below code (given by Sarvesh) and just change the context of the Source element to higher level.
I tested it and it is working fine.
public void ConcatAllOptions(String[] option,ResultList result,Container container){
String output = "" ;
for( int i = 0; i< option.length; i++ )
{
output = output + option<i>;
if ( i != option.length - 1 )
{
output = output+";";
}
}
result.addValue(output);
The field get multiple email values and should seperate them by ; .The email string is not getting properly...u can see Ljava.lang over there beside @
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I set context button only
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The UDF is working fine now.but in the target the corresponding field is showing like
[[Ljava.lang.string;@161b7116 ;[ljava.lang.string;@161b7116
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks All....the problem got solved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi what I can see is this
public void seperator(String[] a[[]],ResultList result,Container container){
Remove this(.String[] a[[]],)
U need to specify this in your Context option of UDF
It will look like this.
The above line should look like this in udf
-
public void Tesst(String[] a,ResultList result,Container container){
-
String target="";
for(int i = 0;i<a.length;i++){
target = target+a;}
if ( ! i == a.length-1)
{
target = target+";";
}
result.addValue(target);
-
}
-
Regards
Abhishek Mahajan
**PLease reward points if helpful**
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Pls make changes to ur code to remove the syntax errors -
public void seperator(String[] a[[]],ResultList result,Container container)
Change the variable declartion in UDF. Just give a as argument then it changes the function like this -
public void seperator(String[] a,ResultList result,Container container
target = target+";";
Change this like this if you want to add ';' in the target string -
target = target+ ';' ;
Regards,
Kishore
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please remove additional brackets here or remove brackets after a[[]]
>>>>public void seperator(String[] a[[]],ResultList result,Container container
use it like
public void seperator(String[] a,ResultList result,Container container
Hope this will help you
Regards
Aashish Sinha
PS : reward points if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.