usync.migrations nupickers(v7) to contentment(v12)
# help-with-umbraco
u
I have a 7.15.10 site I am trying to migrate to v12. I am using usync migrations. Everything works except a nupickers drop-down. I have contentment installed, but the fields always end up empty. Any help would be much appreciated
@leekelleher I know you're out there somewhere 😉
j
Don't know much about nupickers or usync Migration, but I recently found when working with a contentment datalist with checkboxes that it expects the values as
["val1", "val2"]
and before converting to that it would be empty. So I had a converter that changed the values like so:
Copy code
csharp
// Contentment checkbox list expects data as - ["val1", "val2"] - so have to convert it to this format
return $"[\"{string.Join("\", \"", res)}\"]";
Easiest way to check the data format is to create a new contentment property editor set up the way you want with some values and then selecting a value and then seeing what it stores in the database for that. That is the value format you need to emulate when converting old data
u
Thanks for the info. Do you know if it expects an array format for single values? I am using a drop down so it is just a single value. In the migrationsl file it looks like cdata[1234]
j
For single values in my case it just expects the string value, so if you get
cdata[1234]
then it might work if you strip the cdata part and just use
1234
- but it all depends on the datasource and what it expects
k
Hi, I think it dependes on the type of Nupickers dropdown (eg. Enums, SQl, Xpath, or 'just' normal) - but the code for the conversions is here... https://github.com/Jumoo/uSyncMigrations/tree/main/uSync.Migrations.Migrators/Community/NuPickers
if its wrong. then it can always be fixed 🙂
Just to be clear - the content values are migrated in the 'base' class https://github.com/Jumoo/uSyncMigrations/blob/main/uSync.Migrations.Migrators/Community/NuPickers/NuPickersToContentmentDataListBase.cs#L23-L38 the other classes are mainly managing the changes to the datatype.
l
(Putting uSync migrations aside for the moment), as Jesper says Contentment's Data List stores it's values as a JSON string array (this is so it can support hot-swapping of the different UIs). But in terms of the dropdown-list, it will accept either a single string value or a JSON string array (there is JS code that handles this), then on the frontend (ValueConverter bits) it'll be ensured to be an
IEnumerable<string>
.
In terms of uSync Migrations, I'd check that the migrated XML files (for those content items) have the property value in there. If not, then it's an issue with the mappers (like Kevin says, if there's a bug, it can be fixed). If the value is there, then there might be an issue elsewhere (in terms of the Data List's Data Type config 🤔 )
u
Thanks all for the suggestions. I was eventually able to get it working by importing the content in multiple stages.
5 Views