Doing a Calculation on DATE data from pulldata function

Dear all,

I have a form on which does a pull data of an external csv file. One of the fields pulled from an external file is a date column describing the last time a certain medical test was done.

I want to determine when the next test date should be by adding 365 days (1 year) to the date , see image below. However when I try to display the output in a note (nextHVL in the image below) this show as blank.

Does anyone know how I can manipulate dates pulled by pulldata from a csv file and adding days to them?

@Tumaini, the data pulled from a pulldata function gets stored as a string format. You will need to transform the data to a specific format to make calculations which I see you have already done (with dates). Could you also try with a number format to see if you are able to add or subtract?

@Kal_Lam do you mean transform date to a number? I am not sure I have understood you correctly

Is there any solution to this issue?

Greetings,
I have the same problem and I have tried to convert the data in date format obtained from pulldata with int() and number () as Kobotoolbox support points out, I have also tried using date() and it works perfect in Enketo environment but it does not show the values in KoboCollect. I have been trying for several days but I have not found the way and I need to solve it urgently.
In Enketo it works perfect
Here I have also addressed it Question

@Tumaini, @cjneisa, you could do it as outlined below:

In the survey tab of your XLSForm:

In the choices tab of your XLSForm:

Image 2

Note: You will need to convert your date (i,e, E2 to E3) to Epoch date manually through this site here. At the moment, the system will only allow you to do the calculation for a pulled date (from CSV file) by converting the time stamp to Epoch.

Data entry screen as seen in Enketo:

Reference XLSForm:

Pull Data for Dates.xls (34.5 KB)

Reference CSV file:

Codes.csv (239 Bytes)

1 Like