How to get Month in event_date variable

Hello,

I’m trying to get month part of event_date variable with ASSIN Program Rule Action Type. I did something like that :

d2:right(d2:left(V{event_date},5),2)

It’s work fine in web version but not in Android version. Surely because left and right must receive a string value.

Is there another way to retrieve month part of event_date ?

Regards

Hey @didate,
How are you? Yes, there are certains to follow for the android program rules. For example, IMPORTANT: REVIEW your Program Rules before updating to Android 2.2 in production

Therefore, let’s mention @dhis2-android team!

Hi @didate,
I’ve just tried it with the last android version (2.4.1) and it is working fine. This is the expression I’ve used:

d2:right(d2:left(V{current_date},7),2)

V{current_date} will return a date with the following format: yyyy-MM-dd. So the inner d2:left will return the first 7 characters from the left yyyy-MM and then the d2:right will return just MM which is what you are trying to achieve.

5 Likes

Thank you @Pablo it’s working on last android version 2.4.1.
I use the following expression because my dates are in french format (dd-MM-yyyy).

d2:right(d2:left(V{event_date},5),2)

Thank you so much.

2 Likes

Dears, I faced with a problem regarding dashboard. I was trying to develop one data set in the dhis2 i did so and now i cant to open the dashbaord and give me thefollowing message:
ChunkLoadError: Loading chunk 6526 failed.
(missing: DHIS 2 Health Net TPO)

at Object.j (https://dhis-hni.com/dhis-web-dashboard/static/js/main.2080e0a3.js:2:518264)
at https://dhis-hni.com/dhis-web-dashboard/static/js/main.2080e0a3.js:2:509410
at Array.reduce (<anonymous>)
at Function.e (https://dhis-hni.com/dhis-web-dashboard/static/js/main.2080e0a3.js:2:509375)
at https://dhis-hni.com/dhis-web-dashboard/static/js/main.2080e0a3.js:2:616699
at https://dhis-hni.com/dhis-web-dashboard/static/js/main.2080e0a3.js:2:396551
at Es (https://dhis-hni.com/dhis-web-dashboard/static/js/main.2080e0a3.js:2:396700)
at Ol (https://dhis-hni.com/dhis-web-dashboard/static/js/main.2080e0a3.js:2:388664)
at Sl (https://dhis-hni.com/dhis-web-dashboard/static/js/main.2080e0a3.js:2:388589)
at gl (https://dhis-hni.com/dhis-web-dashboard/static/js/main.2080e0a3.js:2:385591)
in Unknown
in Suspense
in Jn
in div
in div
in nr
in Xe
in ke
in De
in Ze
in Ce
in et
in d
in X
in de
in G
in DHIS2RuntimeProvider
in lr
in rr
in Rn
in Jn
in ur
in hr