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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

not able to find user defined routine in list

Hi
I've created an user defined routine and named it as a FileCheck.
When I create a job and put tjava component am not able to find routine I had created using ctrl+space.

Can anyone help ?

Labels (2)
5 Replies
Anonymous
Not applicable
Author

User defined routines have very special tags { }. One of the most important think is you have to give your class a name:

/**
* Specifies a substring consisting of the first n characters of a string.

* {Category} StringUtil

* {param} string("hello world!") string: String.

* {param} int(5) index : index

* {example} startFrom("hello world!",5) # hello
*/
public static String startFrom(String string, int index) {
return string == null ? null : string.substring(0, Math.min(string.length(), index));
}

Here is an working example. The category tag is essential.
Anonymous
Not applicable
Author

Hi jlolling

My class name is FlieCheck as well but still not able to find routine in tjava component when I press ctrl+space.

Do I need to mention the text you have mentioned in your post as a comment ?
Anonymous
Not applicable
Author

Exactly. The code suggestion function finds routines only by this name. The default name is "User Routine" regardless how your class name actually is. This was for my first time also very confusing.
I forgot in my example to tell you: my routine class name was also StringUtil. I have no clue why Talend make things like this more complex than necessary.
Anonymous
Not applicable
Author

Thanks jlolling for this spark !! 0683p000009MACn.png
Anonymous
Not applicable
Author

Keep an eye also to the other parts of the comments. Only by using them you will get a useful code completion for your method.
Because Talend has not documented how these comments are working, I suggest you take a look into the existing once and learn from them. 
I actually do not understand why Talend has introduced its own java-doc format instead of using the existing one and add missing tags to it.