"formatter" is not defined

May i know why i got “formatter” is not defined ?
Do i need to make any setting for using this?
And when i use results.text(formattedDate); , i also got “results” is not defined too.

Hi @ceci_cheung,

The first line of code does contain the “-” character where I suppose it should be the “=” character. Please replace it to the following JavaScript code and let me know if the issue has been resolved:

var myDate = record.fields.StudyDate;

@Marten
image
I think it should be image problem. My script is “=” here with error “formatter is not defined”.

The formatter objet does not exist in the DataMapper because it is useless in that context.

You should extract the value as a date, and then it’s only when you use it inside a document that you can format it with the formatter object.

@Phil
Thanks for reply.

Actually before i use JavaScript mode, i tried to change the Type to Date but it return nothing. Any idea how to convert string to date format?
Thanks

Hi @ceci_cheung,

That’s because the value doesn’t match with the used Date Format. Based on the value I suppose that it’s “year + month + day”, is that correct? If so, please scroll down in the Step Properties pane until you see the Date/Time Format input field, change this value from for example “mm/dd/yyyy hh:nn ap” to “yyyymmdd”.

Hi @Marten

I changed the format to yyyymmdd. But all my data value before “No Default Value” like below:

Can you let me know please what the result is when you refresh your current Data Model overview by clicking on the Refresh button in the Data Model pane?

@Marten
Thanks for your help Marten. Problems solved after i clicked synchronized field and structure button. It can display the date format now.