Type mismatch with pulldata() extracting dates from other feature service

05-06-2022 01:22 AM
New Contributor II

Hi everyone,

I'm running into a problem on a survey when I'm trying to extract date values from another feature service.

The survey required to set up a javascript function to collect data from another feature service and recover the information of some students. Then, in the survey we recover the personal info of these students, among which we have birth dates.

These fields have to be notes and every pull works fine but for the dates. When I extract a date to note it transforms it in epoch format. Usually not an issue, as I would use format-date() to make it readable.

However, whenever I try to use format-date, Connect will return a type mismatch error. Same when using decimal-date-time or date functions.

My first workaround was to keep the birth-date type question as "date" and "read-only". That works for the field and desktop apps but not for the web browser app. Unfortunately, I need this to work on browser as well.

I double-checked that the field type of the pulled date is "date" and I confirm it's "date" and not "string".

I'm attaching a snippet of the survey and the function (minus the url of the pulled service)

I'm out of ideas and wondering if this is a bug or a known issue. I tag the great survey masters @JamesTedrick and @IsmaelChivite for support, but anyone help would be extremely appreciated.


3 Replies
New Contributor II

Sorry for the auto-reply, I'm not sure who to tag other then you @IsmaelChivite and @JamesTedrick for help



0 Kudos
New Contributor II

I was having the same issue on my form. I am working with a consultant - John Lucotch at Equinox Geospatial - and he figured out the following code that works properly:

pulldata_json_returnpulldata("@layer", "getRecord", "feature service url", "WHERE clause")


field_name is the name of the field containing the date you wish to return from the feature layer you are querying


John, my consultant, believes that the json where property is returning the date as a string.  Converting the string to an integer allows the epoch time to run properly in your code.

Occasional Contributor II

I know this is an old post but just wanted to say thanks for this Alex (and your consultant John!) as I was losing my mind trying to format the date from a feature service using pulldata. Hadn't even crossed my mind that the number was coming through as a string as it doesn't appear in the json with quotation marks so just assumed it was already a number. Cheers

0 Kudos