I am designing drug order form in xform 4.3.11, I want to make length of Anti-TB prescription to be calculated from TB prescription end date and TB prescription start date, I followed https://wiki.openmrs.org/display/docs/XForms+Module+Properties+Tab, but calculated field gives undefined result. If needed I will try to reproduce
I want to do the same for ART and other drugs in the same form but it looks like you can only calculate one field and not more than that, when I tried to calculate more fields it says too much recursion. Is there a way to do the same for more than one field in one form?.
I wanted to add calculation fields to other drugs, such as art, ipt, cotrimoxazole and others e.g (new Date(/form/obs/art_presc_end_date/value) - new Date(/form/obs/art_presc_start_date/value))/ (1000 * 3600 * 24) for art, (new Date(/form/obs/cot_presc_end_date/value) - new Date(/form/obs/cot_presc_start_date/value))/ (1000 * 3600 * 24) for cotrimoxazole, (new Date(/form/obs/ipt_presc_end_date/value) - new Date(/form/obs/ipt_presc_start_date/value))/ (1000 * 3600 * 24) for ipt, as shown in the screenshot