[resolved] adding a custom routine?

Highlighted
Four Stars

[resolved] adding a custom routine?

i have an issue when creating a custom routing. i want to convert BigDecimal to Currency, so i use the following code.
package routines;
import java.text.NumberFormat;
import java.util.Locale;
public class FormatNumber {
            public static void[color=black][size=2][font=Courier New] main(String[] args) [/font][/size][/color]throws Exception {
            double num = 1323.526;
            NumberFormat defaultFormat = NumberFormat.getCurrencyInstance();
            System.out.println("US: " + defaultFormat.format(num));
            Locale swedish = new Locale("sv", "SE");
            NumberFormat swedishFormat = NumberFormat.getCurrencyInstance(swedish);
            System.out.println("Swedish: " + swedishFormat.format(num));
      }
}
I load the public class here, and want to change the decimal to currency.



I get this error when loading the public class into the tjavarow.

whats missing?
Community Manager

Re: [resolved] adding a custom routine?

Hi
The format of calling a routine is: routineName.methodName(parameters), please refer to the system routine to define a method in a routine.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: [resolved] adding a custom routine?

Thank you Shong,
is the system routine only editable though paid versions? 
sorry newbie here, i'm looking to convert BigDecimal to currency (adding the thousands comma). 
Is there an easy way to convert this type without writing this in a system routine? meaning can I create a context variable to format it, or even write an expression that converts BigDecimal to comma. 
Thank you,
Paul
Community Manager

Re: [resolved] adding a custom routine?

Hi
The system routine is only readable, if you want to update a system routine, you just need to create a user routine, copy the Java code of system routine and paste them to your user routine. In this case, it is better to create a user routine to achieve the transform, and call the routine in the job, please read article Creating a user routine and call it in a job.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: [resolved] adding a custom routine?

Thanks Shong! okay to resolve.

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

Introduction to Talend Open Studio for Data Quality

Find out about Talend Open Studio for Data Quality

Watch Now

Enabling Data Governance

Learn how to enable Data Governance

Watch Now

The Definitive Guide to Government Data Quality

Take a peek at the definitive guide to Government Data Quality

Read