Thanks Markus,

I will definitely test this!



From: Markus Bekken []
Sent: Tuesday, August 8, 2017 5:40 PM
To: Georgi Chakarov <>
Cc: DHIS Users <>; DHIS 2 Developers list 
Subject: Re: [Dhis2-users] Help with a program rule

Hi there Georgi!
Thanks for the feedback.

It seems you got it almost right except for one little detail on the usage of 
the substring function.

To get the fifth character you would have to change your expression to:
 d2:substring(A{Client ID}, 5, 6) == '2'

There was an error in the doc, so a small update is on the way here:
19.5.6. Reference information: Operators and functions to use in program rule 

Hope this helps!

Best regards

4. aug. 2017 kl. 17.58 skrev Georgi Chakarov 

Hi all (again)! ☺

I have a challenging task for whoever is interested. I find it quite difficult 
working with the functions in program rules expression, especially learning 
from the user manual.

I am trying to execute the following rule:
If the fifth character of Client ID (text attribute) is equal to ‘2’, the Sex 
(Option set attribute) should be equal to ‘Female’. This is an example of 
client ID: 111121111.

This is what I think:
1)      I need to extract the fifth character and evaluate whether it equals 
‘2’. I am using d2:substring(text, start-char-num, end-char-num)
This is my expression d2:substring(A{Client ID}, 5, 5) == '2'

2)      I need to push ‘Female’ option to the Sex attribute. I am not sure how 
to do that from the program rule actions. I tried:
a)       Assign value to Sex attribute – expression is ‘Female’
b)      Assign value to Sex attribute – expression is A{Sex} == 'Female'

None of the combinations 1) + 2a) OR 1) + 2b) worked, regretfully.

Does any of you know or can figure out how this might work?



Georgi Chakarov, CIA |<> | +1-647-478-5634 
x 104 | LogicalOutcomes c/o Centre for Social Innovation, 720 Bathurst Street, 
Toronto Canada M5S 2R4 | You may unsubscribe from receiving commercial 
electronic messages from LogicalOutcomes by emailing<>

Mailing list:
Post to     :<>
Unsubscribe :
More help   :

Mailing list:
Post to     :
Unsubscribe :
More help   :

Reply via email to