W WDK Member Licensed User Sep 27, 2017 #1 I am trying to do a calculation with Big Decimal. I am getting an error stating that I can't have double variables in my formula. Do all variables in a Big Decimal calculation need to be Big Decimal? Also, how do I convert text to Big Decimal? ie. BigDecimalNumber = EditText.text Thanks for any help! WDK Attachments Image 2.png 12.8 KB · Views: 749
I am trying to do a calculation with Big Decimal. I am getting an error stating that I can't have double variables in my formula. Do all variables in a Big Decimal calculation need to be Big Decimal? Also, how do I convert text to Big Decimal? ie. BigDecimalNumber = EditText.text Thanks for any help! WDK
S sorex Expert Licensed User Longtime User Sep 27, 2017 #2 maybe you need long instead of double? Upvote 0
W WDK Member Licensed User Sep 27, 2017 #3 I tried long, but also get the long cannot be converted to Big Decimal. Thanks, WDK Upvote 0
S sorex Expert Licensed User Longtime User Sep 27, 2017 #4 doesn't that lib has own data types to cover this? Upvote 0
W WDK Member Licensed User Sep 27, 2017 #5 Thanks Sorex! You are correct. Appreciate the help! WDK Upvote 0
OliverA Expert Licensed User Longtime User Sep 27, 2017 #6 If you look at the provided XML file for the library, you'll find several Initialize routines. The first one (Initialize) will take a string and convert it to a Big Decimal object. Therefore instead of Code: Copy BigDecimalNumber = EditText.text it should be Code: Copy BigDecimalNumber.Initialize(EditText.text) Please note that all operations (division, multiplication, addition, subtraction) must be done using the provided methods of the class instead of Code: Copy CalculateFormula = FormulaFrom * FormulaTo * Ed it would be Code: Copy CalculateFormula.Initialize5(FormulaFrom.Multiply(FormulaTo.Multiply(Ed))) Where CalculateFormula, FormulaFrom, FormulaTo and Ed have all been Dim'd as the proper big decimal type Note: Code has not been validated. I'm just going off of what I found in the XML file and therefore may be way off base. This is just a more expanded answer to @sorex's hint. Ninja'd as usual.... Upvote 0
If you look at the provided XML file for the library, you'll find several Initialize routines. The first one (Initialize) will take a string and convert it to a Big Decimal object. Therefore instead of Code: Copy BigDecimalNumber = EditText.text it should be Code: Copy BigDecimalNumber.Initialize(EditText.text) Please note that all operations (division, multiplication, addition, subtraction) must be done using the provided methods of the class instead of Code: Copy CalculateFormula = FormulaFrom * FormulaTo * Ed it would be Code: Copy CalculateFormula.Initialize5(FormulaFrom.Multiply(FormulaTo.Multiply(Ed))) Where CalculateFormula, FormulaFrom, FormulaTo and Ed have all been Dim'd as the proper big decimal type Note: Code has not been validated. I'm just going off of what I found in the XML file and therefore may be way off base. This is just a more expanded answer to @sorex's hint. Ninja'd as usual....
W WDK Member Licensed User Sep 27, 2017 #7 Oliver, Thanks for the detailed information. That is really helpful and explains everything I am trying to accomplish. Much appreciated! WDK Upvote 0
Oliver, Thanks for the detailed information. That is really helpful and explains everything I am trying to accomplish. Much appreciated! WDK