If Condition to Return True or Fals

Hello,

I would like to have an IF condition that is able to return TRUE if the result is 15 and FALSE if the result calculated is less than 15 or more than 15. Below is the calculation that returns the number of days a complaint was registered and clossed.

int(decimal-date-time(${date2}) - decimal-date-time(${date1}))

You could do it as outlined in the image shared below:

In the survey tab of your XLSForm:

Data entry screen as seen in Enketo: when nothing is entered

Data entry screen as seen in Enketo: when the date differences are less than 15

Data entry screen as seen in Enketo: when the date differences is exactly 15

Data entry screen as seen in Enketo: when the date differences are more than 15

Reference XLSForm:

Calculate Days.xlsx (10.4 KB)

Thanks so much, though I am still getting a false irrespective of the result being equal to 15 days. See below;

First Calculate: ${num_days1} - 15
Second Calculate: if(${num_days2}=15,‘True’,‘False’)
Note: Case closed in 15 days?: ${true_false}

Where am i going wrong

Yours too gave me a false:

https://enketo.getodk.org/preview?form=https%3A//xlsform.getodk.org/downloads/h484wyxc/Calculate%20Days%200%20With%20IF%20Condition.xml

Oh, it worked after I interchanged True and False.

Thanks so much!

1 Like

Thank you for confirming!