Weight displayed with huge accuracy after kettle load

I am using Kettle to load patient weights (as part of a conversion from RxWorks).

All is OK except that the patient weight shown on the information panel on the left of the Patients screen is displayed as 2.4000000953674316 Kilograms.

The actual weight loaded is of course 2.4 (Diagnostic output from the transform says that the number being handed to the OpenVPMS Loader is 0002.4 )

If I check this patient in, then on the 'New Weight" screen, the weight is displayed as 2.40

If I don't edit this, the infomation panel continues to display 2.4000000953674316

If I do edit this, then the weight is correctly displayed as 2.4

Is this a bug, or can I do something in the Kettle transform to fix the problem?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Weight displayed with huge accuracy after kettle load

You're probably using floats or doubles to represent patient weights.

These can't accurrately represent all numeric values, so often you end up with small differences between the expected value and what can actually be represented by the float.

You could convert the field to a BigDecimal rounded to 2 decimal places, or to a string truncated 2 characters after the '.'.

-Tim

Re: Weight displayed with huge accuracy after kettle load

Thanks Tim - that fixed it.  [I must admit that I did not realise that there were types of numbers other than 'Number' available.]

Syndicate content