Using program rule expressions in Program indicator expressions

Can anyone tell me why I can’t use program rule expressions in Program indicator expressions?

Functions like ceil, floor, round and others are very useful.

Also I tried to use the “Decimals in data output” in the program indicator details, it didn’t work.

Also I tried to simulate the round function using conditional modulo subtraction/addition (the pivot table keeps trying to load) :

C{eB6eQXKY8HA}*C{xGZ2I9aTeXX} -(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 + d2:condition(‘(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 >=50’,1,0)

Thank you in advance.

Please advise.

All the best,

Bernard

cid:image002.png@01D36F50.572585A0

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org


Virus-free. www.avast.com

I found a similar issue on JIRA ([DHIS2-2734] - Jira)

But still doesn’t explain why I can’t use different expressions in program indicators L

All the best,

Bernard

cid:image002.png@01D36F50.572585A0

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

image

···

From: Dhis2-users [mailto:dhis2-users-bounces+lib.ima=pu-ami.org@lists.launchpad.net] On Behalf Of Bernard Sadaka (IM Advisor)
Sent: Tuesday, February 6, 2018 3:53 PM
To: dhis2-users@lists.launchpad.net; ‘DHIS 2 developers’ dhis2-devs@lists.launchpad.net
Subject: [Dhis2-users] Using program rule expressions in Program indicator expressions

Can anyone tell me why I can’t use program rule expressions in Program indicator expressions?

Functions like ceil, floor, round and others are very useful.

Also I tried to use the “Decimals in data output” in the program indicator details, it didn’t work.

Also I tried to simulate the round function using conditional modulo subtraction/addition (the pivot table keeps trying to load) :

C{eB6eQXKY8HA}*C{xGZ2I9aTeXX} -(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 + d2:condition(‘(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 >=50’,1,0)

Thank you in advance.

Please advise.

All the best,

Bernard

cid:image002.png@01D36F50.572585A0

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

Image removed by sender.

Virus-free. www.avast.com

Hi there Bernard,
We aim to support more and hopefully all the program rule functions in program indicators.
Unfortunately we are not there yet, and the list of supported functions in program indicators can be found here:
19.4.5. Reference information: Functions, variables and operators to use in program indicator expressions and filters <Home - DHIS2 Documentation;

Where did you get the wrong number of decimals? In the Pivot or in the Tracker/Event capture?

One question on your expression below, it seems you are trying to round off a constant from your defined constant values? Your use case I would have guessed is to round off a data element or tracked entity attribute value?

Best regards
Markus

···

6. feb. 2018 kl. 15:31 skrev Bernard Sadaka (IM Advisor) <lib.ima@pu-ami.org>:

I found a similar issue on JIRA (https://jira.dhis2.org/browse/DHIS2-2734\)

But still doesn’t explain why I can’t use different expressions in program indicators L

All the best,
Bernard

<image001.png>
Bernard Sadaka
Information Management Advisor
Première Urgence - Aide Médicale Internationale
Nehmeh Building, Sanine Street, Chiyah, 3rd Floor
Ain el Remmaneh, Beirut, Lebanon
E-mail: lib.ima@pu-ami.org <mailto:lib.ima@pu-ami.org>
Cell: +961 71 004 881 (208)
Skype: imapuami
Website: https://www.pu-ami.org <https://www.pu-ami.org/&gt;

From: Dhis2-users [mailto:dhis2-users-bounces+lib.ima=pu-ami.org@lists.launchpad.net <mailto:dhis2-users-bounces+lib.ima=pu-ami.org@lists.launchpad.net>] On Behalf Of Bernard Sadaka (IM Advisor)
Sent: Tuesday, February 6, 2018 3:53 PM
To: dhis2-users@lists.launchpad.net <mailto:dhis2-users@lists.launchpad.net>; 'DHIS 2 developers' <dhis2-devs@lists.launchpad.net <mailto:dhis2-devs@lists.launchpad.net>>
Subject: [Dhis2-users] Using program rule expressions in Program indicator expressions

Can anyone tell me why I can’t use program rule expressions in Program indicator expressions?
Functions like ceil, floor, round and others are very useful.

Also I tried to use the “Decimals in data output” in the program indicator details, it didn’t work.
Also I tried to simulate the round function using conditional modulo subtraction/addition (the pivot table keeps trying to load) :
C{eB6eQXKY8HA}*C{xGZ2I9aTeXX} -(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 + d2:condition('(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 >=50',1,0)

Thank you in advance.
Please advise.

All the best,
Bernard

<image001.png>
Bernard Sadaka
Information Management Advisor
Première Urgence - Aide Médicale Internationale
Nehmeh Building, Sanine Street, Chiyah, 3rd Floor
Ain el Remmaneh, Beirut, Lebanon
E-mail: lib.ima@pu-ami.org <mailto:lib.ima@pu-ami.org>
Cell: +961 71 004 881 (208)
Skype: imapuami
Website: https://www.pu-ami.org <https://www.pu-ami.org/&gt;

<image003.jpg> <Safe emailing Mac | Avast;
Virus-free. www.avast.com <Safe emailing Mac | Avast;

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net <mailto:dhis2-devs@lists.launchpad.net>
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

Hello Markus,

Thank you for the list and explanation; is there any expected timeline for that? (JIRA issue, I can track?)

With regards to the number of decimals, even if set to zero at the program indicator and after running the analytics, the “pivot table” still shows the digits.

Regarding the expression, yes it is true, I’m rounding the constants, because I am actually creating a budget report and applying a discount rate on the individual cost of a specific PHCC activity and aggregating them using sum (so I am using one constant per cost of a PHCC activity and another for discount rate of all activities). I ended up using exact values in the constant instead of a discounted factor; after all, changing a discount factor is easier than changing 200 values individually when the discount rate changes. The reason for all this, is that with a discounted factor there is a need to round the values and disallow them to be cumulated in the sum of the aggregation in order to keep the report error free.

Hope the above explains my usecase: aggregating the data elements of a TEI and multiplying them by a cost constant and a discount factor. And yes the round functions in this case would be very beneficial.

Thank you again for your support.

All the best,

Bernard

cid:image002.png@01D36F50.572585A0

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

···

From: Markus Bekken [mailto:markus@dhis2.org]
Sent: Wednesday, February 7, 2018 9:52 AM
To: Bernard Sadaka (IM Advisor) lib.ima@pu-ami.org
Cc: dhis2-users@lists.launchpad.net; DHIS 2 developers dhis2-devs@lists.launchpad.net
Subject: Re: [Dhis2-devs] [Dhis2-users] Using program rule expressions in Program indicator expressions

Hi there Bernard,

We aim to support more and hopefully all the program rule functions in program indicators.

Unfortunately we are not there yet, and the list of supported functions in program indicators can be found here:

19.4.5. Reference information: Functions, variables and operators to use in program indicator expressions and filters

Where did you get the wrong number of decimals? In the Pivot or in the Tracker/Event capture?

One question on your expression below, it seems you are trying to round off a constant from your defined constant values? Your use case I would have guessed is to round off a data element or tracked entity attribute value?

Best regards

Markus

  1. feb. 2018 kl. 15:31 skrev Bernard Sadaka (IM Advisor) lib.ima@pu-ami.org:

I found a similar issue on JIRA (https://jira.dhis2.org/browse/DHIS2-2734)

But still doesn’t explain why I can’t use different expressions in program indicators L

All the best,

Bernard

<image001.png>

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

From: Dhis2-users [mailto:dhis2-users-bounces+lib.ima=pu-ami.org@lists.launchpad.net] **On Behalf Of **Bernard Sadaka (IM Advisor)
Sent: Tuesday, February 6, 2018 3:53 PM
To: dhis2-users@lists.launchpad.net; ‘DHIS 2 developers’ dhis2-devs@lists.launchpad.net
Subject: [Dhis2-users] Using program rule expressions in Program indicator expressions

Can anyone tell me why I can’t use program rule expressions in Program indicator expressions?

Functions like ceil, floor, round and others are very useful.

Also I tried to use the “Decimals in data output” in the program indicator details, it didn’t work.

Also I tried to simulate the round function using conditional modulo subtraction/addition (the pivot table keeps trying to load) :

C{eB6eQXKY8HA}*C{xGZ2I9aTeXX} -(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 + d2:condition(‘(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 >=50’,1,0)

Thank you in advance.

Please advise.

All the best,

Bernard

<image001.png>

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

<image003.jpg>

Virus-free. www.avast.com


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

Hi again Bernard,
it seems that the problem you experience might be caused by the presence of parenthesis in the expression inside your d2:condition. This is a bug, and can be followed up here: [DHIS2-2813] - Jira
If you are able to write your expression without parenthesis, this is a workaround that you can use.

The general implementation of new functions in program indicators is followed up in jira issues, but there was none covering the mathematical functions you need here, so I created one that you can look at: [DHIS2-2814] - Jira
Please complement or comment, and consider voting for it :slight_smile:

Best regards,
Markus

P.S. won't X*100%100 always be 0?

···

7. feb. 2018 kl. 09:21 skrev Bernard Sadaka (IM Advisor) <lib.ima@pu-ami.org>:

Hello Markus,
Thank you for the list and explanation; is there any expected timeline for that? (JIRA issue, I can track?)

With regards to the number of decimals, even if set to zero at the program indicator and after running the analytics, the “pivot table” still shows the digits.

Regarding the expression, yes it is true, I’m rounding the constants, because I am actually creating a budget report and applying a discount rate on the individual cost of a specific PHCC activity and aggregating them using sum (so I am using one constant per cost of a PHCC activity and another for discount rate of all activities). I ended up using exact values in the constant instead of a discounted factor; after all, changing a discount factor is easier than changing 200 values individually when the discount rate changes. The reason for all this, is that with a discounted factor there is a need to round the values and disallow them to be cumulated in the sum of the aggregation in order to keep the report error free.
Hope the above explains my usecase: aggregating the data elements of a TEI and multiplying them by a cost constant and a discount factor. And yes the round functions in this case would be very beneficial.

Thank you again for your support.

All the best,
Bernard

<image001.png>
Bernard Sadaka
Information Management Advisor
Première Urgence - Aide Médicale Internationale
Nehmeh Building, Sanine Street, Chiyah, 3rd Floor
Ain el Remmaneh, Beirut, Lebanon
E-mail: lib.ima@pu-ami.org <mailto:lib.ima@pu-ami.org>
Cell: +961 71 004 881 (208)
Skype: imapuami
Website: https://www.pu-ami.org <https://www.pu-ami.org/&gt;

From: Markus Bekken [mailto:markus@dhis2.org]
Sent: Wednesday, February 7, 2018 9:52 AM
To: Bernard Sadaka (IM Advisor) <lib.ima@pu-ami.org>
Cc: dhis2-users@lists.launchpad.net; DHIS 2 developers <dhis2-devs@lists.launchpad.net>
Subject: Re: [Dhis2-devs] [Dhis2-users] Using program rule expressions in Program indicator expressions

Hi there Bernard,
We aim to support more and hopefully all the program rule functions in program indicators.
Unfortunately we are not there yet, and the list of supported functions in program indicators can be found here:
19.4.5. Reference information: Functions, variables and operators to use in program indicator expressions and filters <Home - DHIS2 Documentation;

Where did you get the wrong number of decimals? In the Pivot or in the Tracker/Event capture?

One question on your expression below, it seems you are trying to round off a constant from your defined constant values? Your use case I would have guessed is to round off a data element or tracked entity attribute value?

Best regards
Markus

6. feb. 2018 kl. 15:31 skrev Bernard Sadaka (IM Advisor) <lib.ima@pu-ami.org <mailto:lib.ima@pu-ami.org>>:

I found a similar issue on JIRA (https://jira.dhis2.org/browse/DHIS2-2734\)

But still doesn’t explain why I can’t use different expressions in program indicators L

All the best,
Bernard

<image001.png>
Bernard Sadaka
Information Management Advisor
Première Urgence - Aide Médicale Internationale
Nehmeh Building, Sanine Street, Chiyah, 3rd Floor
Ain el Remmaneh, Beirut, Lebanon
E-mail: lib.ima@pu-ami.org <mailto:lib.ima@pu-ami.org>
Cell: +961 71 004 881 (208)
Skype: imapuami
Website: https://www.pu-ami.org <https://www.pu-ami.org/&gt;

From: Dhis2-users [mailto:dhis2-users-bounces+lib.ima=pu-ami.org@lists.launchpad.net <mailto:dhis2-users-bounces+lib.ima=pu-ami.org@lists.launchpad.net>] On Behalf Of Bernard Sadaka (IM Advisor)
Sent: Tuesday, February 6, 2018 3:53 PM
To: dhis2-users@lists.launchpad.net <mailto:dhis2-users@lists.launchpad.net>; 'DHIS 2 developers' <dhis2-devs@lists.launchpad.net <mailto:dhis2-devs@lists.launchpad.net>>
Subject: [Dhis2-users] Using program rule expressions in Program indicator expressions

Can anyone tell me why I can’t use program rule expressions in Program indicator expressions?
Functions like ceil, floor, round and others are very useful.

Also I tried to use the “Decimals in data output” in the program indicator details, it didn’t work.
Also I tried to simulate the round function using conditional modulo subtraction/addition (the pivot table keeps trying to load) :
C{eB6eQXKY8HA}*C{xGZ2I9aTeXX} -(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 + d2:condition('(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 >=50',1,0)

Thank you in advance.
Please advise.

All the best,
Bernard

<image001.png>
Bernard Sadaka
Information Management Advisor
Première Urgence - Aide Médicale Internationale
Nehmeh Building, Sanine Street, Chiyah, 3rd Floor
Ain el Remmaneh, Beirut, Lebanon
E-mail: lib.ima@pu-ami.org <mailto:lib.ima@pu-ami.org>
Cell: +961 71 004 881 (208)
Skype: imapuami
Website: https://www.pu-ami.org <https://www.pu-ami.org/&gt;

<image003.jpg> <Safe emailing Mac | Avast;
Virus-free. www.avast.com <Safe emailing Mac | Avast;

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net <mailto:dhis2-devs@lists.launchpad.net>
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

Thank You Markus,

I started following the 2 issues and voted for them.

As for (X*100)%100 , it returns the first 2 digits after the comma, therefore the expression mentioned earlier would have simulates a rounding function if the parenthesis were processed correctly as mentioned in the JIRA issue :wink:

Thank you again for the support.

All the best,

Bernard

cid:image002.png@01D36F50.572585A0

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

···

From: Markus Bekken [mailto:markus@dhis2.org]
Sent: Friday, February 9, 2018 11:16 AM
To: Bernard Sadaka (IM Advisor) lib.ima@pu-ami.org
Cc: dhis2-users dhis2-users@lists.launchpad.net; DHIS 2 developers dhis2-devs@lists.launchpad.net
Subject: Re: [Dhis2-devs] [Dhis2-users] Using program rule expressions in Program indicator expressions

Hi again Bernard,

it seems that the problem you experience might be caused by the presence of parenthesis in the expression inside your d2:condition. This is a bug, and can be followed up here: https://jira.dhis2.org/browse/DHIS2-2813

If you are able to write your expression without parenthesis, this is a workaround that you can use.

The general implementation of new functions in program indicators is followed up in jira issues, but there was none covering the mathematical functions you need here, so I created one that you can look at: https://jira.dhis2.org/browse/DHIS2-2814

Please complement or comment, and consider voting for it :slight_smile:

Best regards,

Markus

P.S. won’t X*100%100 always be 0?

  1. feb. 2018 kl. 09:21 skrev Bernard Sadaka (IM Advisor) lib.ima@pu-ami.org:

Hello Markus,

Thank you for the list and explanation; is there any expected timeline for that? (JIRA issue, I can track?)

With regards to the number of decimals, even if set to zero at the program indicator and after running the analytics, the “pivot table” still shows the digits.

Regarding the expression, yes it is true, I’m rounding the constants, because I am actually creating a budget report and applying a discount rate on the individual cost of a specific PHCC activity and aggregating them using sum (so I am using one constant per cost of a PHCC activity and another for discount rate of all activities). I ended up using exact values in the constant instead of a discounted factor; after all, changing a discount factor is easier than changing 200 values individually when the discount rate changes. The reason for all this, is that with a discounted factor there is a need to round the values and disallow them to be cumulated in the sum of the aggregation in order to keep the report error free.

Hope the above explains my usecase: aggregating the data elements of a TEI and multiplying them by a cost constant and a discount factor. And yes the round functions in this case would be very beneficial.

Thank you again for your support.

All the best,

Bernard

<image001.png>

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

From: Markus Bekken [mailto:markus@dhis2.org]
Sent: Wednesday, February 7, 2018 9:52 AM
To: Bernard Sadaka (IM Advisor) lib.ima@pu-ami.org
Cc: dhis2-users@lists.launchpad.net; DHIS 2 developers dhis2-devs@lists.launchpad.net
Subject: Re: [Dhis2-devs] [Dhis2-users] Using program rule expressions in Program indicator expressions

Hi there Bernard,

We aim to support more and hopefully all the program rule functions in program indicators.

Unfortunately we are not there yet, and the list of supported functions in program indicators can be found here:

19.4.5. Reference information: Functions, variables and operators to use in program indicator expressions and filters

Where did you get the wrong number of decimals? In the Pivot or in the Tracker/Event capture?

One question on your expression below, it seems you are trying to round off a constant from your defined constant values? Your use case I would have guessed is to round off a data element or tracked entity attribute value?

Best regards

Markus

  1. feb. 2018 kl. 15:31 skrev Bernard Sadaka (IM Advisor) lib.ima@pu-ami.org:

I found a similar issue on JIRA (https://jira.dhis2.org/browse/DHIS2-2734)

But still doesn’t explain why I can’t use different expressions in program indicators L

All the best,

Bernard

<image001.png>

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

From: Dhis2-users [mailto:dhis2-users-bounces+lib.ima=pu-ami.org@lists.launchpad.net] **On Behalf Of **Bernard Sadaka (IM Advisor)
Sent: Tuesday, February 6, 2018 3:53 PM
To: dhis2-users@lists.launchpad.net; ‘DHIS 2 developers’ dhis2-devs@lists.launchpad.net
Subject: [Dhis2-users] Using program rule expressions in Program indicator expressions

Can anyone tell me why I can’t use program rule expressions in Program indicator expressions?

Functions like ceil, floor, round and others are very useful.

Also I tried to use the “Decimals in data output” in the program indicator details, it didn’t work.

Also I tried to simulate the round function using conditional modulo subtraction/addition (the pivot table keeps trying to load) :

C{eB6eQXKY8HA}*C{xGZ2I9aTeXX} -(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 + d2:condition(‘(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 >=50’,1,0)

Thank you in advance.

Please advise.

All the best,

Bernard

<image001.png>

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

<image003.jpg>

Virus-free. www.avast.com


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

Hi Markus and Bernard,

At the start of last year, we reported this exclusion of parentheses from all program indicator functions as a bug (DHIS2-590), but it actually turned out to be intentional, so was changed from a bug to an Improvement.

Since it seems to keep cropping up as an issue, is there any chance we could sneak this Improvement into 2.30? Even if, for performance reasons, we still need to exclude nested functions, it would be great to be able to use parentheses within function expressions.

Cheers, Sam.

···

From: Dhis2-users dhis2-users-bounces+samuel.johnson=qebo.co.uk@lists.launchpad.net on behalf of Markus Bekken markus@dhis2.org

Date: Friday, 9 February 2018 at 09:20

To: “Bernard Sadaka (IM Advisor)” lib.ima@pu-ami.org

Cc: dhis2-users dhis2-users@lists.launchpad.net, DHIS2 Developers dhis2-devs@lists.launchpad.net

Subject: Re: [Dhis2-users] [Dhis2-devs] Using program rule expressions in Program indicator expressions

Hi again Bernard,

it seems that the problem you experience might be caused by the presence of parenthesis in the expression inside your d2:condition. This is a bug, and can be followed up here: https://jira.dhis2.org/browse/DHIS2-2813

If you are able to write your expression without parenthesis, this is a workaround that you can use.

The general implementation of new functions in program indicators is followed up in jira issues, but there was none covering the mathematical functions you need here, so I created one that you can look at: https://jira.dhis2.org/browse/DHIS2-2814

Please complement or comment, and consider voting for it :slight_smile:

Best regards,

Markus

P.S. won’t X*100%100 always be 0?

  1. feb. 2018 kl. 09:21 skrev Bernard Sadaka (IM Advisor) lib.ima@pu-ami.org:

Hello Markus,

Thank you for the list and explanation; is there any expected timeline for that? (JIRA issue, I can track?)

With regards to the number of decimals, even if set to zero at the program indicator and after running the analytics, the “pivot table” still shows the digits.

Regarding the expression, yes it is true, I’m rounding the constants, because I am actually creating a budget report and applying a discount rate on the individual cost of a specific PHCC activity and aggregating them using sum (so I am using one constant per cost of a PHCC activity and another for discount rate of all activities). I ended up using exact values in the constant instead of a discounted factor; after all, changing a discount factor is easier than changing 200 values individually when the discount rate changes. The reason for all this, is that with a discounted factor there is a need to round the values and disallow them to be cumulated in the sum of the aggregation in order to keep the report error free.

Hope the above explains my usecase: aggregating the data elements of a TEI and multiplying them by a cost constant and a discount factor. And yes the round functions in this case would be very beneficial.

Thank you again for your support.

All the best,

Bernard

<image001.png>

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

From: Markus Bekken [mailto:markus@dhis2.org]

Sent: Wednesday, February 7, 2018 9:52 AM

To: Bernard Sadaka (IM Advisor) lib.ima@pu-ami.org

Cc: dhis2-users@lists.launchpad.net ; DHIS 2 developers dhis2-devs@lists.launchpad.net

Subject: Re: [Dhis2-devs] [Dhis2-users] Using program rule expressions in Program indicator expressions

Hi there Bernard,

We aim to support more and hopefully all the program rule functions in program indicators.

Unfortunately we are not there yet, and the list of supported functions in program indicators can be found here:

19.4.5. Reference information: Functions, variables and operators to use in program indicator expressions and filters

Where did you get the wrong number of decimals? In the Pivot or in the Tracker/Event capture?

One question on your expression below, it seems you are trying to round off a constant from your defined constant values? Your use case I would have guessed is to round off a data element or tracked entity attribute value?

Best regards

Markus

  1. feb. 2018 kl. 15:31 skrev Bernard Sadaka (IM Advisor) lib.ima@pu-ami.org:

I found a similar issue on JIRA (https://jira.dhis2.org/browse/DHIS2-2734)

But still doesn’t explain why I can’t use different expressions in program indicators L

All the best,

Bernard

<image001.png>

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

From: Dhis2-users [mailto:dhis2-users-bounces+lib.ima=pu-ami.org@lists.launchpad.net] ** On Behalf Of **Bernard Sadaka (IM Advisor)

Sent: Tuesday, February 6, 2018 3:53 PM

To: dhis2-users@lists.launchpad.net ; ‘DHIS 2 developers’ dhis2-devs@lists.launchpad.net

Subject: [Dhis2-users] Using program rule expressions in Program indicator expressions

Can anyone tell me why I can’t use program rule expressions in Program indicator expressions?

Functions like ceil, floor, round and others are very useful.

Also I tried to use the “Decimals in data output” in the program indicator details, it didn’t work.

Also I tried to simulate the round function using conditional modulo subtraction/addition (the pivot table keeps trying to load) :

C{eB6eQXKY8HA}*C{xGZ2I9aTeXX} -(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 + d2:condition(‘(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 >=50’,1,0)

Thank you in advance.

Please advise.

All the best,

Bernard

<image001.png>

Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail: lib.ima@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website: https://www.pu-ami.org

<image003.jpg>

Virus-free. www.avast.com


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