# Unlike Enketo, in Collect, my calculations do not work

Dear community,
I am experiencing something weird on Collect and I could not find a solution in existing messages. Using a series of calculate and concatenate functions, works perfectly on Enketo and on Kobo platform, but it does not work in Collect.

In one of my forms, I need to make Kobo create an id number based on the input of a date question previously provided by enumerator. The id number should be composed, among others, by a time range of 4 cifres, indicating the starting and the ending month (number) of a given activity. E.i. If the date was 1 January, I want kobo to calculate the month range equal to β0102β , indicating January (01) as starting month and February (02) as ending month.

I used a series of calculations to assess the conditions and I used concatenate function to pull together the calculation results and obtain the id number.

When using Collect app, while calculating the starting month goes well, the calculate function does not to work and the in the id number, it appear simply an empty space.
All formulas work well in Enketo and on KoboToolbox platform, but it does not work in C0llect.
I attach the XLSForm, for your reference.
Any idea of what is wrong with Kobo Collect?
Thanks a million times for your suggestions and workaround (if any)!
Lavinia

Form_03_v3.xlsx (13.2 KB)

@Lavinia, maybe try the same with mathematical operators instead of the `if-statement` to see if that helps?

Dear Kal_Lam
I did use If-function to write the conditions - see picture attached.
As in the previous example, if the date was in a date between January or February, I want kobo to calculcate the month range as β0102β, as follows:
q102 is the harvest date.

calculating the harvest month:
format-date(\${q102},β%nβ)

calculating starting month:
if(\${q_annof}>=β1β and \${q_annof}<=β2β,β01β,β ') β all good here,

calculating ending month:
if(\${q_concat}=β01β,β02β,β ') β it does not compute the conditions and returns simply an empty field.

it sounds to me, as calculating a conditions on a calculation question is the problemβ¦ I thought of inserting an instance to simply store the result of the first calculation(s) (no display) and use that one as reference for the second(s)β¦ yet I donβt know howβ¦

Any suggestion from the community is super appreciated!

See the entire XLS in attachement,
Lavinia

Hello Community,
i solved the issues as Kal_Lam suggested by inserting a mathematical expression instead of If-statement. Calculation function worked perfectly, no issue with Collect nor Enketo.
thanks!
Lavinia

1 Like