Have you tried this? (from D7 Help - TBcd type): "You can create a Variant that represents a TBcd value using the VarFMTBcdCreate function. In fact, the easiest way to manipulate TBcd values is to create Variants for them and use the built-in operators provided by the Variant type."
Decimal places are not normally stored within BCD values. Therefore, the decimal place value is implied in the type and not explicit (basically it's whatever you say it is).
Any BCD value has an accompanying value (most times) which indicates the number of decimal places and should be read to get the value and changed to change the number of decimal places.
From what I gather, BCDScale would be what you want. BCDPrecision is the total digit count if I understand correctly. The BCD value is stored in a record (Tbcd) along with other values which determine scale, precision, sign, and so on.
However, you may be running into a separate issue. What exactly is happening? And what are you doing precisely with BCDs? Are you sure you are getting a proper result?
Nevermind the post above, I think I misread the intention. If you are talking text input, something like DjangMan's post will do nicely (though you might want to check for valid input before you do such a thing)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.