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

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

conversion issue from string to bigdecimal?

hi guys,
my input is like tis..
Process_Compliance
-----------------------
N-Apl
3.5
4.3
3.5
N-Apl
4.2
N-Apl

my script in tmap is---->
row2.Process_Compliance.equals("N-Apl")
?BigDecimal.valueOf(0):
new BigDecimal(row2.Process_Compliance);
need output as
Process_Compliance
-----------------------
0
3.5
4.3
3.5
0
4.2
0
when i run my job with above script,i am getting following bug..

xception in component tMap_1
java.lang.NumberFormatException
at java.math.BigDecimal.<init>(Unknown Source)
at java.math.BigDecimal.<init>(Unknown Source)
at

pls let me know any one 0683p000009MACn.png
thanking u
Labels (3)
9 Replies
Anonymous
Not applicable
Author

Hi
You'd better set the type of this column "String" and type expression in tMap as follow.
row2.Process_Compliance.equals("N-Apl")?"0":row2.Process_Compliance

Regards,
Pedro
Anonymous
Not applicable
Author

hi pedro,
thanks for given quick reply...,i understood wht u mean.....but my target table field as bigdecimal always....

if that is the case,how we can convert from string to bigdecimal?

pls let me know....
Anonymous
Not applicable
Author

Hi
Here is another workaround.
Use tReplace component to replace "N-Apl" with "0".
Then use tMap to convert String to BigDecimal.
new BigDecimal(row.ColumnName)                    //row.ColumnName should be String.

Regards,
Pedro
Anonymous
Not applicable
Author

hi pedro,
i am getting...
Process_Compliance
-----------------------
0.00
0.00
0.00
0.00
0.00
0.00
after i used the baove code,any how...i am getting input as ...
Process_Compliance(Input Column)
-----------------------
N-Apl
3.5
4.3
3.5
N-Avl
4.2
NA
sorry,the above logic is not helpfull,
why can't we decode in tmap & convert from string to bigdecimal????????,can we get that way......any thing...

thanks
Anonymous
Not applicable
Author

Hi
Here are the screenshots.
Regards,
Pedro
Anonymous
Not applicable
Author

hi pedro,
my input is different...
tis is my input,
Process_Compliance(Input Column)
-----------------------
N-Apl
3.5
4.3
3.5
N-Avl
4.2
NA
how we can use tReplace tis is the case?
Anonymous
Not applicable
Author

Hi
You can check "Advanced mode" of tReplace.
"^N.*"

Regards,
Pedro
Anonymous
Not applicable
Author

it's works fine... 0683p000009MACn.png

Thank u Pedro.... (Y)
Anonymous
Not applicable
Author

hi guys,
i am getting following issue with tmap......after i done the above steps...
Exception in component tMap_1
java.lang.NumberFormatException
at java.math.BigDecimal.<init>(Unknown Source)
at java.math.BigDecimal.<init>(Unknown Source)

pls let me know any one wht was the cause?

thank u