Hi, I have a dropdown datatype and, in version 1.2, I had to put the value in my csv to map the datatype. Now, in 2.0, it seems that it does not understand value. Do I have to use text instead in my csv?
I am having difficulty getting cmsImport to match the text in a property dropdown (ultimate picker based on nodes). Can't see anything in the manual pertaining to this. Should it be doable?
Think the ultimate picker isn't supported out of the box. It is doable using a FieldAdapter, might want to checkout the documentation or this blogpost for that. Basically it takes a value and converts it to the desired format for the ultimate picker,The main issue with pickers is that most of the times you want to import url's and map those against nodes. This is really diffcult because it's hard to find a relation between the imported content and the url.
But what do you want to import, maybe I can help you with a solution.
PS. It did cross my mind that the additional spacing (and hyphens) put in by the ultimate picker might bethe problem. So I changes it to only show one level and still it didn't pick anything up
Hi Tony you are right, namespace is CMSImport.Extensions.FieldAdapter reference the CMSImport.Extensions project.
Complete example below, no need to cast the value to varchar. Only thing is that you need to make sure that the value you return is in the exact same format as the picker it normally would store. I usually check the cmsPropertyData table in the database how things get stored,
using System;
using umbraco.cms.businesslogic.property;
using CMSImport.Extensions.FieldAdapter;
namespace CMSImportLibrary.FieldAdapters.DefaultFieldAdapters
{
///<summary>//////</summary>publicclassBooleanFieldAdapter : IFieldAdapter
{
#region IFieldAdapter Members
///<summary>/// Contains the GUID of the datatype we want to parse using this FieldAdapter///</summary>///<value></value>publicGuid DataTypeId
{
get { returnnewGuid("38b352c1-e9f8-4fd8-9324-9a2eab06d97a"); }
}
///<summary>/// Parse the data///</summary>///<param name="value">The value to parse</param>///<param name="fieldAdapterService">The field adapter service.</param>///<returns></returns>publicobject Parse(object value, Property property, FieldAdapterOptions fieldAdapterService)
{
if (!(value.Equals("0") || value.Equals("1")))
{
bool boolValue = false;
if (bool.TryParse(value.ToString(), out boolValue))
{
return boolValue ? 1 : 0;
}
}
return value;
}
#endregion
}
}
Import Value or Text
Hi, I have a dropdown datatype and, in version 1.2, I had to put the value in my csv to map the datatype. Now, in 2.0, it seems that it does not understand value. Do I have to use text instead in my csv?
Ok, I figured it out. Now, I have to use the text instead of the value from my dropdown.
Hi Great that you already figured it out, indeed you need the text but that should also have been the case in 1.2
Cheers,
Richard
I am having difficulty getting cmsImport to match the text in a property dropdown (ultimate picker based on nodes). Can't see anything in the manual pertaining to this. Should it be doable?
Hi Tony
Think the ultimate picker isn't supported out of the box. It is doable using a FieldAdapter, might want to checkout the documentation or this blogpost for that. Basically it takes a value and converts it to the desired format for the ultimate picker,The main issue with pickers is that most of the times you want to import url's and map those against nodes. This is really diffcult because it's hard to find a relation between the imported content and the url.
But what do you want to import, maybe I can help you with a solution.
Best,
Richard
I have a bunch of nodes representing some fields in the imported data. One set are for, say, location:
The field in the CSV may read France or Manchester etc. I want to pick the relevant node.
(In the meantime, I'll check out hte blog and the documentation again)
PS. It did cross my mind that the additional spacing (and hyphens) put in by the ultimate picker might bethe problem. So I changes it to only show one level and still it didn't pick anything up
HI Tony,
You should check out the database how it stores the info, Then create a FieldAdapter that converts your data to that format then all should work,
Cheers,
Richard
The example in your blogpost seems to be out of date, there is an issue with the namespace CMSImportLibrary.Interfaces
Should I really need to cast a value from text to Nvarchar?
Edit: the value is already being treated as NVarchar. It is being stored in the database, but has no relation to the values in the picker dropdown
Hi Tony you are right, namespace is CMSImport.Extensions.FieldAdapter reference the CMSImport.Extensions project.
Complete example below, no need to cast the value to varchar. Only thing is that you need to make sure that the value you return is in the exact same format as the picker it normally would store. I usually check the cmsPropertyData table in the database how things get stored,
Hope this helps,
Richard
is working on a reply...