cancel
Showing results for 
Search instead for 
Did you mean: 

Error in mapping

Former Member
0 Kudos

Hello friends,

I need to know the length of a string, so I used a simple UDF and it's throwing error.

I gave the argument a as string

Then added this code

int len=a.length();

return len;

This UDF I mapped to the target, but I am getting error

Could you please tell me why this is not working

Accepted Solutions (1)

Accepted Solutions (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

wH you want UDF, use standard function LENGTH . it will work.

Former Member
0 Kudos

Thanks Raja

It's working. still I was wondering what was wrong with this, thanks for your input

Radhika

rajasekhar_reddy14
Active Contributor
0 Kudos

strange... can you post error message here, is it compatibility issue?

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

Since you are returning an interger and the return type is string might be it is throwing error. You've to write your code like

return len.toString();

Regards

Priyanka

Former Member
0 Kudos

I used Priyanka's code and this is the error I got

int cannot be dereferenced

This was the code that I used

int len=a.length();

return len.toString();

Argument a as string was passed

Ryan-Crosby
Active Contributor
0 Kudos

Hi,

You can use either of these ways to return a String representation of the int:


String ret = Integer.toString(len);
return ret;

OR


String ret = String.valueOf(len);
return ret;

Regards,

Ryan Crosby

Former Member
0 Kudos

Thanks Ryan

That's what I wanted to knw

Answers (0)