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?

4 REPLIES
Twelve Stars

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()

Rilhia Solutions
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.

Twelve Stars

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.

Rilhia Solutions
Six 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