Age Calculation Error "xpath type mismatch exception invalid"

08-02-2020 08:12 AM
New Contributor III

I have a text field to collect a date of birth in mm-dd-yyyy. I then have a series of calculations to convert it to yyyy-mm-dd and turn it into a date field whereby I can then calculate a persons age. The age makes subsequent questions relevant or not (ie. is the person a minor or not). This works in my original form.

I created a new form and copy and pasted that section into the new form for the same purpose. The new form now gives me an error message:


Below is the sample of the xls form with the dob/age calculations:


I initially did the 'paste only values' and I've tried deleting the cells and then rewriting from scratch, but both had no effect. I've checked the sheet for any connections and there are none. In the original form, the dob/age calculations are within a repeat and are not in the new form, but I don't see how that would affect this.




0 Kudos
2 Replies
Esri Frequent Contributor

Hi Ryan,

It looks like this is a type mismatch error, caused by running an expression on a text field or using an answer from a previous question that is text, but trying to run a date or numeric expression on it. Calculate questions by default are text question, however if you set the bind::type, and/or bind::esri:fieldtype to the expected correct field type, the expression should work as expected.

If you are still having issues, can you please share your xlsx file.



New Contributor III

When I removed the pt_dobdate row and then changed the types in the pt_dobstring row (bind::type and bind::esri:fieldtype to esriFieldTypeDate and dateTime respectively) it worked!

Thanks for the help,


textpt_dobDATE OF BIRTH:mm-dd-yyyy1099-99-9999