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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Transform a BigDecimal

Hi,

I want to transform a BigDecimal, like this -.22 that I read with a tFileDelimited component, in a BigDecimal like this -0.22, so i want to add a zero between the "-" and ".".

I tried to use the function add() but it always gives me an exception.

There is some other function in the tMap that allows me to do this transformation or another method i can use?

Thanks 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

You do not need to do this.  The BigDecimal is a number class. It will hold the number as a number and format really does not matter. In fact, if you specify your BigDecimal in a tJava as below.....

 

String stringBd = "-.22";

BigDecimal bd = new BigDecimal(stringBd);

System.out.println(bd.toPlainString());

.....it will print out "-0.22".

View solution in original post

1 Reply
Anonymous
Not applicable
Author

You do not need to do this.  The BigDecimal is a number class. It will hold the number as a number and format really does not matter. In fact, if you specify your BigDecimal in a tJava as below.....

 

String stringBd = "-.22";

BigDecimal bd = new BigDecimal(stringBd);

System.out.println(bd.toPlainString());

.....it will print out "-0.22".