Number(${date}) does not work if ${date} is a datestring pulled using pulldata

1. What is the issue? Please be detailed.

I'm trying to create logic in my form to ascertain whether today falls within 2 given dates. start_date and end_date are both calculated using pulldata from a csv file.

As per the documentation here, date-formatted strings are supposed to be converted to number type using number(). This works in Enketo.
However ODK Collect does not do this conversion, and the output remains blank.

I've tested this with the latest version of ODK Collect v2022.4.4

2. What steps can we take to reproduce this issue?

I've attached the form xlsx and the pulldata csv that can be used to replicate the issue.

pulldata.csv (171 Bytes)
form.xlsx (9.9 KB)

Is there any workaround to achieve this? This is a critical part of my workflow.

Edit:
Enketo Screenshot:

Collect Screenshot:

1 Like

dear @ks_1 ,

your problem is similar to the one here

I found the solution but converting the file via Xlsform Offline and instead of using number() I used decimal-date-time().

See attached files

form.xlsx (9.3 KB)
form.xml (4.6 KB)

Alas I'm using Kobotoolbox and it doesn't allow me to deploy.

I even tried doing format-date(string(pulldata(...))) but it doesn't work. Any other ideas? :face_with_diagonal_mouth:

FWIW, this does sound very much like the bug mentioned earlier (https://github.com/getodk/javarosa/issues/405), which is still open/unresolved.

I don't know why I didn't think of it, but here's the workaround. :slight_smile: