Try our conversational search powered by Generative AI!

Csv import for meta field type: 'String Dictionary'

Vote:
 

Is it possible to import meta field of type 'String Dictionary' using EPiServer Commerce Csv import?

If so, then how that should look in mapping file and csv file?


PS. I'm using: "Entry w/ Meta Data" mapping type.

 

For example, to import meta filed type: 'Short string', mapping file part for that is:

<RuleItem>
    <SourColumnName>Price Other</SourColumnName>
    <SourColumnType>System.String</SourColumnType>
    <DestColumnName>PriceOther</DestColumnName>
    <DestColumnType>ShortString</DestColumnType>
    <FillType>CopyValue</FillType>
    <CustomValue />
    <DestColumnSystem>False</DestColumnSystem>
  </RuleItem>

and csv is stright forward one column.

 

Its described here:

http://sdk.episerver.com/commerce/1.1.1/Content/User%20Guide/CatalogManagement/Using%20CSV%20Files%20to%20Quickly.htm

But i cannot find anything about 'String Dictionary' meta field type.

#62373
Oct 23, 2012 14:38
Vote:
 

Solved this!

 

Using this method to generate string for csv import file:

private static string ToMetaStringDictionary(IList<string> list)
        {
            var dictionary = new MetaStringDictionary();
            var serializer = new JavaScriptSerializer();

            for (var i = 0; i < list.Count; i++)
            {
                dictionary.Add("Bullet" + i, list[i]);
            }

            return serializer.Serialize(dictionary);
        }

It will generate something like this:

"[{""Key"":""bullet2"",""Value"":""value 1""},{""Key"":""bullet1"",""Value"":""value 2""},{""Key"":""bullet0"",""Value"":""value 3""}]"

    

and use this in mapping file:

<RuleItem>
    <SourColumnName>Bullet Point List</SourColumnName>
    <SourColumnType>System.String</SourColumnType>
    <DestColumnName>BulletPointList</DestColumnName>
    <DestColumnType>StringDictionary</DestColumnType>
    <FillType>CopyValue</FillType>
    <CustomValue />
    <DestColumnSystem>False</DestColumnSystem>
  </RuleItem>

    

#62400
Oct 24, 2012 9:14
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.