Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
amitdadri
Contributor
Contributor

Need to get String less than 60 length

Hi all previously I was using    routines.utils.getNotes(SFOpportunities.Notes__c)  to extract the values from field named Notes , length 32768   into next field with a lenght of 60  both string. and I am getting an error 

 

 

Exception in component tMap_4 
java.lang.StringIndexOutOfBoundsException: String index out of range: 60
at java.lang.String.substring(Unknown Source)
at routines.utils.getNotes(utils.java:571)

 

 

can anyone see this 

Labels (3)
1 Solution

Accepted Solutions
vapukov
Master II
Master II

in saleforce they have SOQL - https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm

in talend You can check real lengths, something like:

row1.col==null?
null
:StringHandling.LEN(row1.col)<60?
row1.col
:StringHandling.LEFT(row1.col, 60)

View solution in original post

7 Replies
vapukov
Master II
Master II

Hi

 

it means column shorter than 60, for example " "

check in source database MIN(lenght()) for column

amitdadri
Contributor
Contributor
Author

Hi @vapukov thanks for reply, the source also has the field length as 32768 only, 

vapukov
Master II
Master II

do You check this by query? (not by definition)
You need any 1 rows shorter to have error

amitdadri
Contributor
Contributor
Author

Hi @vapukov the source is Salesforce and I dont know much to query in that, I just work in Talend, can you please tell me about that 

vapukov
Master II
Master II

in saleforce they have SOQL - https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm

in talend You can check real lengths, something like:

row1.col==null?
null
:StringHandling.LEN(row1.col)<60?
row1.col
:StringHandling.LEFT(row1.col, 60)
amitdadri
Contributor
Contributor
Author

I do understand your solution, meanwhile I used this

StringHandling.LEN(coLname)>58?colname.substring(0,58):colname

Is this fine?

The min lenght is 0 it is nullable, so I don't understand is then why do I get the error

@vapukov

 

 

vapukov
Master II
Master II

it similar, I just add check for NULL