org.mozilla.javascript.NativeDate not compatible with DATE f

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

org.mozilla.javascript.NativeDate not compatible with DATE f

#1

Postby xren » Tue Jul 26, 2016 9:45 pm

Hi,

I have a table with Date as data type.

when I try to set a value from a shared function
like fields.date1.value = new Date(datestr); the datestr is in format 'yyyy-mm-dd' and from a previous form step.

it gave the following exception:

Wrapped com.ebasetech.xi.exceptions.FormRuntimeException: Unable to set value for field F_EMP_IT_SYS__sysAccess-BY_DATE, object type org.mozilla.javascript.NativeDate is not compatible with field type DATE

How this can be fixed.

Thanks,
Xiaoli
0 x

Ian
Ebase Staff
Posts: 26
Joined: Wed Oct 10, 2007 9:40 am
Location: Ebase HQ
Contact:

re: org.mozilla.javascript.NativeDate is not compatible fiel

#2

Postby Ian » Wed Jul 27, 2016 12:58 pm

I believe the problem you are having is to do with the format of datestr.
The JavaScript Date function does not like the dash (-) in yyyy-mm-dd.
What is acceptable is a forward slash (/) eg: yyyy/mm/dd.

If you are unable to change the format of the source date then
the following code snipit shows how to convert the source date
into something that is acceptable to JavaScript:

Code: Select all

// Example 1 - can't change orginal format

var datestr = '2016-07-26';
tables.F_EMP_IT_SYSTESTDATE__SYSACCESS.insertRow();
tables.F_EMP_IT_SYSTESTDATE__SYSACCESS.BY_DATE.value = new Date(datestr.replace(/-/g,"/"));

0 x


Who is online

Users browsing this forum: No registered users and 17 guests