Date not importing into document type specific date field
Hi Richard
I'm importing some content from the SQL Server 2005 database of our old proprietary CMS.
One of our Umbraco document types has a document property of type "Date picker with time", which I've mapped to a date field in the old DB, but no value appears. If, in the same import run, I also map the generic Create Date field to the same field in the old DB, its value gets populated no problem.
I've tried modifying the stored procedure in the old DB to output the date as a varchar (YYYY-MM-dd hh:mm:ss) rather than a datetime, and specified the same date format in the advanced settings, but the same thing happens: no value appears in the custom field, but it does import into the generic Create Date field.
Do you have any ideas / am I missing something obvious?
Thanks Richard. In fact, I think we have a bit of a freak problem with the name of our custom field (Publish date), which seems to be conflicting with the generic Publish at field. I've renamed the field and it now imports correctly.
I can confirm this behaviour. Things go haywire if you have a field in your document type called Publish Date. If you change the name of the field, everything works as expected.
It has to do with the fact that there already is a native field Publish Date. It would be nice though if CMSImport would play nice with this situation where there's another field with the same name.
Yes sorry CMSImport has a few harde coded properties that it uses for the normal fixed content porperties. It's my mistake for not having prefixes when I created the first release in 2008. The prroperties are:
nodeName
publishDate
expireDate
createDate
It's not possible to prefix those now since that will mess up existing import definitions. I've created a workitem for the next release that shows a warning in case your document type contains a dynamic property that conflicts with the fixed ones.
Yes that would be possible but that can go wrong and in case of scheduled imports people might figure that out after weeks of not importing stuff, so I think I stick with the warning...
For the Umbraco V5 version that I'm building from scratch those aliasses get's replaced with a more specific alias.
I have defined a CMS import task and when i run it manually it works fine with no error and copies data from one database to another successfully.
If I run the same task as a Scheduled task, the Task runs but throws an error :
Errors:Error while importing data for property '' :Object reference not set to an instance of an object.
The error doesnt show name of a property where it fails so its hard to debug. Also as the task otherwise runs fine, not sure why it fails as a scheduled task.
This should not happen. I think this is because the locale settings of you when logging in and the user who imports the data are different.What you can do is open the advanced settings of the date field (green icon) where you map the property against and make sure the format is exactly the same as the format of the datasource. Then CMSImport will use that format string to import the data and ignore locale settings etc.
Thanks for a quick reply. I am logged onto Umbraco with Admin login and the scheduled task runs under the same login.
When I run the Import Definition logged in as an Admin, it works fine. As I said the error is when run the same definition under scheduled task. Therehave a notification email which looks like below -
This is an automated mail to inform you that the task Hourly Consultant Update executed
Statistics:
1089 records in datasource
0 records added
0 records updated
1088 records skipped
2 errors during import
Errors:Error while importing data for property '' :Object reference not set to an instance of an object.
No fields on the Import definition are of type DATE.
CMSImport: A record failed to import for alias error:System.NullReferenceException: Object reference not set to an instance of an object. at umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String LoginName, String Email, MemberType mbt, User u) at umbraco.cms.businesslogic.member.Member.MakeNew(String Name, MemberType mbt, User u) at CMSImportLibrary.Import.MemberImporter.ImportMembers(ImportState state, User importAsUser, String datasourceFile)
Ah I was under assumption that you used date format because this thread was about date issues. Are you absolutly sure you are importing the same datasource? This is a message about Umbraco that can't create a new member. I have the assumption the loginname is empty.
Date not importing into document type specific date field
Hi Richard
I'm importing some content from the SQL Server 2005 database of our old proprietary CMS.
One of our Umbraco document types has a document property of type "Date picker with time", which I've mapped to a date field in the old DB, but no value appears. If, in the same import run, I also map the generic Create Date field to the same field in the old DB, its value gets populated no problem.
I've tried modifying the stored procedure in the old DB to output the date as a varchar (YYYY-MM-dd hh:mm:ss) rather than a datetime, and specified the same date format in the advanced settings, but the same thing happens: no value appears in the custom field, but it does import into the generic Create Date field.
Do you have any ideas / am I missing something obvious?
Many thanks,
Jeremy
Hi Jeremy,
I get the correct values when importing from sqlserver (sorry don't have 2005). Sure the mapped value isn't null?
Cheers,
Richard
Thanks Richard. In fact, I think we have a bit of a freak problem with the name of our custom field (Publish date), which seems to be conflicting with the generic Publish at field. I've renamed the field and it now imports correctly.
Thanks again
Jeremy
Hi, Richard and Jeremy.
I can confirm this behaviour. Things go haywire if you have a field in your document type called Publish Date. If you change the name of the field, everything works as expected.
It has to do with the fact that there already is a native field Publish Date. It would be nice though if CMSImport would play nice with this situation where there's another field with the same name.
Regards!
Hi Guys,
Yes sorry CMSImport has a few harde coded properties that it uses for the normal fixed content porperties. It's my mistake for not having prefixes when I created the first release in 2008. The prroperties are:
Tricky issue. Thank you for the explanantion. Would it be possible to update all the existing import definitions in some sort of batch operation?
Although I just renamed the property. That worked too.
Hi Gijs,
Yes that would be possible but that can go wrong and in case of scheduled imports people might figure that out after weeks of not importing stuff, so I think I stick with the warning...
For the Umbraco V5 version that I'm building from scratch those aliasses get's replaced with a more specific alias.
Best,
Richard
Hi there
I have defined a CMS import task and when i run it manually it works fine with no error and copies data from one database to another successfully.
If I run the same task as a Scheduled task, the Task runs but throws an error :
Errors:Error while importing data for property '' :Object reference not set to an instance of an object.
The error doesnt show name of a property where it fails so its hard to debug. Also as the task otherwise runs fine, not sure why it fails as a scheduled task.
E
Hi,
This should not happen. I think this is because the locale settings of you when logging in and the user who imports the data are different.What you can do is open the advanced settings of the date field (green icon) where you map the property against and make sure the format is exactly the same as the format of the datasource. Then CMSImport will use that format string to import the data and ignore locale settings etc.
Cheers,
Richard
Thanks for a quick reply. I am logged onto Umbraco with Admin login and the scheduled task runs under the same login.
When I run the Import Definition logged in as an Admin, it works fine. As I said the error is when run the same definition under scheduled task. There have a notification email which looks like below -
This is an automated mail to inform you that the task Hourly Consultant Update executed
Statistics:
1089 records in datasource
0 records added
0 records updated
1088 records skipped
2 errors during import
Errors:Error while importing data for property '' :Object reference not set to an instance of an object.
No fields on the Import definition are of type DATE.
E
That is weird, should not be of any difference. Can you check the UmbracoLog table for the detail of this exception?
Thanks,
Richard
CMSImport: A record failed to import for alias error:System.NullReferenceException: Object reference not set to an instance of an object. at umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String LoginName, String Email, MemberType mbt, User u) at umbraco.cms.businesslogic.member.Member.MakeNew(String Name, MemberType mbt, User u) at CMSImportLibrary.Import.MemberImporter.ImportMembers(ImportState state, User importAsUser, String datasourceFile)
Ah I was under assumption that you used date format because this thread was about date issues. Are you absolutly sure you are importing the same datasource? This is a message about Umbraco that can't create a new member. I have the assumption the loginname is empty.
@Gijs,
You can use Publish Date proerties again. I've just fixed this in the 2.3 release of CMSImport
http://our.umbraco.org/projects/developer-tools/cmsimport/
Cheers,
Richard
is working on a reply...