I'm implementing a 2.5.2 version of cmsimport on umbraco 6.5.2
I've added a custom datasource which returns an xml file.
I've added a custom fieldadapter which is supposed to parse a date value which is not automatically recognised by cmsimport. Only: the fieldadapter doesn't get hit in debug mode. At least: the DataTypeId Guid is hit, but not the Parse function. It basically ignores it, and returns the same error that it does without the fieldadapter.
I assume the Umbraco version is incorrect? But FieldAdapter should work, better to use a FieldProvider by the way, one of the recent changes.
But weird that your Adapter never gets hit, it should so can you share the code? If you are mapping against a native Umbraco Date field I would love to know which one I've missed in the advanced settings.
namespace ImportService.CmsImport.FieldAdapters { public class Date : IFieldAdapter { public Guid DataTypeId { get { return new Guid("2740bb3b-13c7-477f-87b8-be6a3c7f3464"); } }
public object Parse(object value, Property property, FieldAdapterOptions fieldAdapterOptions) { /* * If date value, first do a parse exact, otherwise the date is not recognised as date. * this takes care of birthdate and memberdate * */ if (property.PropertyType.DataTypeDefinition.Text == "Date Picker") { DateTime parsedDate; DateTime.TryParseExact(value.ToString(), "yyyyMMdd", CustomFunctions.SetCulture(), DateTimeStyles.None, out parsedDate);
fieldadapter not working
Hi Richard,
I'm implementing a 2.5.2 version of cmsimport on umbraco 6.5.2
I've added a custom datasource which returns an xml file.
I've added a custom fieldadapter which is supposed to parse a date value which is not automatically recognised by cmsimport. Only: the fieldadapter doesn't get hit in debug mode. At least: the DataTypeId Guid is hit, but not the Parse function. It basically ignores it, and returns the same error that it does without the fieldadapter.
Any ideas?
Martin
It seems the events don't get hit either. Both the interfaces (ApplicationEventHandler and umbraco.BusinessLogic.ApplicationBase)
Hi Marin,
I assume the Umbraco version is incorrect? But FieldAdapter should work, better to use a FieldProvider by the way, one of the recent changes.
But weird that your Adapter never gets hit, it should so can you share the code? If you are mapping against a native Umbraco Date field I would love to know which one I've missed in the advanced settings.
Best,
Richard
6.5.1 indeed :)
I will try out the FieldProvider as well.
Here is the code.
So if you put a breakpoint on the if statement it doesn't get hit? Weird it should be since all is public.
by the way: trying out the fieldprovider. Can you show me a sample? I can't open your page. It gives me a javascript error (waiting for script to execute) http://www.richardsoeteman.net/CategoryView,category,CMSImport.aspx:152
(I think I had the same experience some time ago and emailed you on it, by now I have a new pc, but the error continues in firefox and chrome)
Yes blog needs to be updated, some video script is killing it try this one http://www.richardsoeteman.net/2013/12/05/FieldProvidersInCMSImport25.aspx
Ok, I got it working using the fieldprovider. Thanks!
(the Example image was loaded at the absolute bottom of the page, I discovered it at last :)
Thanks!
is working on a reply...