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
org.mozilla.javascript.NativeDate not compatible with DATE f
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 272
- Joined: Fri Dec 14, 2012 2:55 pm
- Location: Ottawa
-
- 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
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:
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