Function unavailable (?)

Five Stars

Function unavailable (?)

So I just tried to convert a string to uppercase, and it popped an error. I'm still following the tutorial, so I'm pretty sure I'm supposed to write EmployeeInput.Name.toUpperCase() to get it right, but it just breaks. The IDE doesn't suggest it when autocompleting either, so I just went with StringHandling.UPCASE(EmployeeInput.Name) instead, which the IDE does accept.

 

I believe String.ToUpperCase() is a valid function in Java, so I have to ask: What are the limitations in this respect? Are there any other features I should be aware of before continuing? Should this even be happening at all?

Community Manager

Re: Function unavailable (?)

Java is case sensitive. Are you sure you were using the correct case?

 

EmployeeInput.Name.toUpperCase() is not the same as EmployeeInput.Name.ToUpperCase()

 

I gave that as an example because in your question you used both ....

toUpperCase() 

....and ....

ToUpperCase()

Five Stars

Re: Function unavailable (?)

You are right, I mixed them up. This is what I did:

1. I copy-pasted from the tutorial into the editor. It broke.

2. I went back to default, pressed Ctrl + Space and scanned through the results, none matched.

3. I tried the code with the different function name, also broke (Obviously).

4. I typed "toupper" and pressed Ctrl + Space, this time it suggested what looks like this static class that provides string conversion tools, I jammed the item in and it exported the results as expected to the target file.

 

In short, it didn't really work at all, the autocomplete tool never suggested the option provided by the tutorial (and it's not case-sensitive AFAIK), and I haven't typed a smidge in JAVA for the last 2 years, so I might be wrong, but I remember using it in the past.

Community Manager

Re: Function unavailable (?)

Sometimes the expression builders are not great at helping you out. If you cannot get autocomplete to work, drop a tJava onto your job and try out your expression there. Autocomplete will work in this component. Once it is happy in a tJava component, copy and paste it your expression. 

 

Another way of tracking Java issues is to click on the "Code" tab in the bottom left corner of your workspace. It will force the Java to be written and will reveal errors with a red line on the right of the screen. You *may* find your error is actually somewhere else.

Eight Stars

Re: Function unavailable (?)

According to this, it's a valid Java function (since JDK 1.0):

 

https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#toUpperCase()

 

Not sure why it wouldn't show up, but I've had issues with autocomplete in Eclipse, which is Talend's underlying engine, so it might be that.

 

David

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now