Handling Decimal Numbers in DHIS2

Dear all,

Can someone remind me how to allow/save decimal numbers in DHIS2 PostgresSQL database.

When an indicator value is 87.7 the system just displays 87.

Lungo

Hi Lungo,

do you think you explain a bit more what you want here? Ie, do you refer to saving data values in data entry, or getting aggregated indicator data in analysis modules like pivot table?

Currently, the rules for decimals (which are admittedly a bit simplistic) are that for values between 1 and -1 we display 2 decimals, for other values we display 1 decimal. We are thinking of making this more intelligent by calculating and using the number of significant decimals, but it should support your needs based on your description.

regards,

Lars

···

On Mon, Oct 28, 2013 at 12:45 PM, Juma Lungo jlungo@yahoo.com wrote:

Dear all,

Can someone remind me how to allow/save decimal numbers in DHIS2 PostgresSQL database.

When an indicator value is 87.7 the system just displays 87.

Lungo


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

For a pivot table example see here:

http://apps.dhis2.org/demo/api/reportTables/KmJwftqlU86/data.html

Dear Lars

Since we are using the DHIS2 to compute financial figures, we need to display the values either in two decimal places or zero decimal places. Not one decimal places. Now, if we format our iReports to zero decimal places, when a user enters say 6.47, the database will convert it into 6.5 and iReport will convert it to 7. Thus, a user enters 6.47, instead of getting 6 she end up getting 7. It is a big challenge for us.

Lungo

···

On Sunday, December 1, 2013 9:28 PM, Lars Helge Øverland larshelge@gmail.com wrote:

For a pivot table example see here:

http://apps.dhis2.org/demo/api/reportTables/KmJwftqlU86/data.html

Okay Lungo, I understand. The issue is that in most cases, 1 decimal is appropriate. Then, some people want no decimals and some want no rounding at all.

I assume your use-case is that you save a pivot table (report table) as a favorite, then use it as source for a financial standard report designed in ireport.

I propose this: We introduce a new option in pivot table module (and in analytics api) called “Skip rounding of values”. When ticket, we do not round off the values at all, providing full precision for values (we are using double as value type in the api). Then, you can select this option for your table and leave it to ireport to round off to the appropriate number of decimals (use the number format). How does that sound to you?

Lars

···

On Sun, Dec 1, 2013 at 8:36 PM, Juma Lungo jlungo@yahoo.com wrote:

Dear Lars

Since we are using the DHIS2 to compute financial figures, we need to display the values either in two decimal places or zero decimal places. Not one decimal places. Now, if we format our iReports to zero decimal places, when a user enters say 6.47, the database will convert it into 6.5 and iReport will convert it to 7. Thus, a user enters 6.47, instead of getting 6 she end up getting 7. It is a big challenge for us.

Lungo

On Sunday, December 1, 2013 9:28 PM, Lars Helge Øverland larshelge@gmail.com wrote:

For a pivot table example see here:

http://apps.dhis2.org/demo/api/reportTables/KmJwftqlU86/data.html

Hi Lars,

Thanks for this. Can this also be applied to the data entry screen and data set reports? If you consider a use case that deals with data ranging from 0 - 1. rounding up or down makes the difference quite significant.

This would be a very useful function and would like to request extending beyond just the pivot table.

Regards,

Busoye

···

On Sun, Dec 1, 2013 at 8:36 PM, Juma Lungo jlungo@yahoo.com wrote:

Dear Lars

Since we are using the DHIS2 to compute financial figures, we need to display the values either in two decimal places or zero decimal places. Not one decimal places. Now, if we format our iReports to zero decimal places, when a user enters say 6.47, the database will convert it into 6.5 and iReport will convert it to 7. Thus, a user enters 6.47, instead of getting 6 she end up getting 7. It is a big challenge for us.

Lungo

On Sunday, December 1, 2013 9:28 PM, Lars Helge Øverland larshelge@gmail.com wrote:

For a pivot table example see here:

http://apps.dhis2.org/demo/api/reportTables/KmJwftqlU86/data.html

Hi Busoye,

in fact the situation is not that the “database converts the numbers”. The system simply stores whatever you enter. But the aggregate data is being rounded off before presented through the API. So there should be no need to modify data entry as such.

cheers

Lars

···

On Mon, Dec 2, 2013 at 12:46 PM, Adebusoye Anifalaje busoye@hisp.org wrote:

Hi Lars,

Thanks for this. Can this also be applied to the data entry screen and data set reports? If you consider a use case that deals with data ranging from 0 - 1. rounding up or down makes the difference quite significant.

This would be a very useful function and would like to request extending beyond just the pivot table.

Regards,

Busoye

On 2 Dec 2013, at 11:25, Lars Helge Øverland larshelge@gmail.com wrote:

Okay Lungo, I understand. The issue is that in most cases, 1 decimal is appropriate. Then, some people want no decimals and some want no rounding at all.

I assume your use-case is that you save a pivot table (report table) as a favorite, then use it as source for a financial standard report designed in ireport.

I propose this: We introduce a new option in pivot table module (and in analytics api) called “Skip rounding of values”. When ticket, we do not round off the values at all, providing full precision for values (we are using double as value type in the api). Then, you can select this option for your table and leave it to ireport to round off to the appropriate number of decimals (use the number format). How does that sound to you?

Lars


Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

On Sun, Dec 1, 2013 at 8:36 PM, Juma Lungo jlungo@yahoo.com wrote:

Dear Lars

Since we are using the DHIS2 to compute financial figures, we need to display the values either in two decimal places or zero decimal places. Not one decimal places. Now, if we format our iReports to zero decimal places, when a user enters say 6.47, the database will convert it into 6.5 and iReport will convert it to 7. Thus, a user enters 6.47, instead of getting 6 she end up getting 7. It is a big challenge for us.

Lungo

On Sunday, December 1, 2013 9:28 PM, Lars Helge Øverland larshelge@gmail.com wrote:

For a pivot table example see here:

http://apps.dhis2.org/demo/api/reportTables/KmJwftqlU86/data.html

Hi Lars,

this sound excellent. If we can control the number of decimal points to be displayed as you described here. We will go for zero decimal places or two decimal places.

Lungo

Okay Lungo, I understand. The issue is that in most cases, 1 decimal is appropriate. Then, some people want no decimals and some want no rounding at all.

I assume your use-case is that you save a pivot table (report table) as a favorite, then use it as source for a financial standard report designed in ireport.

I propose this: We introduce a new option in pivot table module (and in analytics api) called “Skip rounding of values”. When ticket, we do not round off the values at all, providing full precision for values (we are using double as value type in the api). Then, you can select this option for your table and leave it to ireport to round off to the appropriate number of decimals (use the number format). How does that sound to you?

Lars

···

On Monday, December 2, 2013 2:25 PM, Lars Helge Øverland larshelge@gmail.com wrote:

On Sun, Dec 1, 2013 at 8:36 PM, Juma Lungo jlungo@yahoo.com wrote:

Dear Lars

Since we are using the DHIS2 to compute financial figures, we need to display the values either in two decimal places or zero decimal places. Not one decimal places. Now, if we format our iReports to zero decimal places, when a user enters say 6.47, the database will convert it into 6.5 and iReport will convert it to 7. Thus, a user enters 6.47, instead of getting 6 she end up getting 7. It is a big challenge for us.

Lungo

On Sunday, December 1, 2013 9:28 PM, Lars Helge Øverland larshelge@gmail.com wrote:

For a pivot table example see here:

http://apps.dhis2.org/demo/api/reportTables/KmJwftqlU86/data.html

Okay fine. Blueprint here:

https://blueprints.launchpad.net/dhis2/+spec/analytics-skip-rounding-option

Put up for 2.15 for now.

Lars

···

On Tue, Dec 3, 2013 at 9:43 PM, Juma Lungo jlungo@yahoo.com wrote:

Hi Lars,

this sound excellent. If we can control the number of decimal points to be displayed as you described here. We will go for zero decimal places or two decimal places.

Lungo

On Monday, December 2, 2013 2:25 PM, Lars Helge Øverland larshelge@gmail.com wrote:

Okay Lungo, I understand. The issue is that in most cases, 1 decimal is appropriate. Then, some people want no decimals and some want no rounding at all.

I assume your use-case is that you save a pivot table (report table) as a favorite, then use it as source for a financial standard report designed in ireport.

I propose this: We introduce a new option in pivot table module (and in analytics api) called “Skip rounding of values”. When ticket, we do not round off the values at all, providing full precision for values (we are using double as value type in the api). Then, you can select this option for your table and leave it to ireport to round off to the appropriate number of decimals (use the number format). How does that sound to you?

Lars

On Sun, Dec 1, 2013 at 8:36 PM, Juma Lungo jlungo@yahoo.com wrote:

Dear Lars

Since we are using the DHIS2 to compute financial figures, we need to display the values either in two decimal places or zero decimal places. Not one decimal places. Now, if we format our iReports to zero decimal places, when a user enters say 6.47, the database will convert it into 6.5 and iReport will convert it to 7. Thus, a user enters 6.47, instead of getting 6 she end up getting 7. It is a big challenge for us.

Lungo

On Sunday, December 1, 2013 9:28 PM, Lars Helge Øverland larshelge@gmail.com wrote:

For a pivot table example see here:

http://apps.dhis2.org/demo/api/reportTables/KmJwftqlU86/data.html

Thanks Lars

However, we have solved the Decimal issue by introducing variables in iReport and apply “Math.round” function to the variables. The problem is now solved, though it required investiment of extra energy.

Lungo

Okay fine. Blueprint here:

https://blueprints.launchpad.net/dhis2/+spec/analytics-skip-rounding-option

Put up for 2.15 for now.

Lars

···

On Monday, December 9, 2013 8:05 PM, Lars Helge Øverland larshelge@gmail.com wrote:

On Tue, Dec 3, 2013 at 9:43 PM, Juma Lungo jlungo@yahoo.com wrote:

Hi Lars,

this sound excellent. If we can control the number of decimal points to be displayed as you described here. We will go for zero decimal places or two decimal places.

Lungo

On Monday, December 2, 2013 2:25 PM, Lars Helge Øverland larshelge@gmail.com wrote:

Okay Lungo, I understand. The issue is that in most cases, 1 decimal is appropriate. Then, some people want no decimals and some want no rounding at all.

I assume your use-case is that you save a pivot table (report table) as a favorite, then use it as source for a financial standard report designed in ireport.

I propose this: We introduce a new option in pivot table module (and in analytics api) called “Skip rounding of values”. When ticket, we do not round off the values at all, providing full precision for values (we are using double as value type in the api). Then, you can select this option for your table and leave it to ireport to round off to the appropriate number of decimals (use the number format). How does that sound to you?

Lars

On Sun, Dec 1, 2013 at 8:36 PM, Juma Lungo jlungo@yahoo.com wrote:

Dear Lars

Since we are using the DHIS2 to compute financial figures, we need to display the values either in two decimal places or zero decimal places. Not one decimal places. Now, if we format our iReports to zero decimal places, when a user enters say 6.47, the database will convert it into 6.5 and iReport will convert it to 7. Thus, a user enters 6.47, instead of getting 6 she end up getting 7. It is a big challenge for us.

Lungo

On Sunday, December 1, 2013 9:28 PM, Lars Helge Øverland larshelge@gmail.com wrote:

For a pivot table example see here:

http://apps.dhis2.org/demo/api/reportTables/KmJwftqlU86/data.html