Calculated Field with Dates displays differently on Desktop vs Android Tablet

Skip to first unread message

Bike Park SA

Dec 20, 2016, 5:13:01 AM12/20/16
to mementodatabase

Hi All

The formula of a calculated field using a date returns a different value on the desktop than on a tablet.

substring(formatDate(#{birthday}),length(formatDate(#{birthday})) - 4,length(formatDate(#{birthday}))) + switch(trim(substring(formatDate(#{birthday}),indexOf(formatDate(#{birthday}),' ',0),indexOf(formatDate(#{birthday}),' ',3))),'January','01','February','02','March','03','April','04','May','05','June','06','July','07','August','08','September','09','October','10','November','11','12') + switch(length(trim(substring(formatDate(#{birthday}),0,2))),1, concat('0', trim(substring(formatDate(#{birthday}),0,2))) ,substring(formatDateTime(#{birthday}),0,2)) + substring('#{cell phone number}',7,10)

Returns on Desktop: 198112Sa886
Returns on Tablet: 19811226886

What is very funny is that in the one library it displays incorrectly (see Returns on Desktop above) when used as a Calculated field, but when a linked library is using the same field through a reference formula of substring('#{visitors.bpsa member number}',0,11) it displays correctly on the desktop in the other Libray that is linked (see Returns on Tablet above)

On the Tablet it returns the correct value ((see Returns on Tablet above) in BOTH Libraries

Is this to do with a Location setting of the date on Windows?

How do I fix this?

Bill Crews

Dec 20, 2016, 9:45:26 AM12/20/16
to mementodatabase
I would highly recommend reading the wiki page for the JavaScript field ( and maybe taking the link, if necessary, to external documentation on the memory.min.js library or just the docs for the Date field ( I think something like:

moment().format('YYYYMMDD') + field('cell phone number').substring(7,10)

might substitute for all that Calculation field code, if you check the box to load the moment.min.js library.

Bike Park SA

Dec 22, 2016, 9:18:33 AM12/22/16
to mementodatabase
Hi Bill

Much appreciated

Your guidance helped me to rewrite and solve the issue

Bill Crews

Dec 22, 2016, 10:25:34 AM12/22/16
to mementodatabase
Glad to be of help.
Reply all
Reply to author
0 new messages