Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
PK1673977888
Contributor
Contributor

syntax to check BigDecimal if it's greater than 50

Hi Team,

How to check the BigDecimal if it's greater than 50? below is my requirement

lnk_tfm_null_col.CURRENT_BALANCE.subtract(

lnk_tfm_null_col

.SCHEDULED_BALANCE) < 50 ? BigDecimal.ZERO : 

lnk_tfm_null_col.CURRENT_BALANCE.subtract(lnk_tfm_null_col.SCHEDULED_BALANCE

Any help much appreciated

Labels (3)
1 Reply
Anonymous
Not applicable

This Javadoc page can help you....

 

https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html#compareTo-java.math.BigDecimal-

 

I haven't tested this and have simply written it here, but I would try this....

 

(lnk_tfm_null_col.CURRENT_BALANCE.subtract(lnk_tfm_null_col.SCHEDULED_BALANCE)).compareTo(new BigDecimal("50"))==-1 ? BigDecimal.ZERO : lnk_tfm_null_col.CURRENT_BALANCE.subtract(lnk_tfm_null_col.SCHEDULED_BALANCE)

 

As I said, not tested so you may need to make some changes for potential typos.