Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • suzyb 474 posts 932 karma points
    Apr 09, 2013 @ 10:39
    suzyb
    0

    Importing values into a dropdown

    I have a drop down with a number of values that have an ampersand in them and I am trying to match imported data with those drop down values.

    The values are the same in the drop down and in my excel spreadsheet but whenever I import it always seems to add new values to the drop down instead of using existing ones.

    I thought that this was happening because the values in umbraco get encoded so the & becomes & so I created a FieldAdapter to also encode the value being imported however it still doesn't seem to work.

    This is the code of my parse function.

    if (property.PropertyType.DataTypeDefinition.Text == "[site] Faculty Drop Down")
    {
    value = HttpContext.Current.Server.HtmlEncode(value.ToString());
    }
    return value;

    Can anyone advise how I can solve this issue.

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Apr 09, 2013 @ 11:36
    Richard Soeteman
    0

    Hi suzy,

    what happens if you just replace the character instead of htmlencode?

    Thanks,

    Richard

  • suzyb 474 posts 932 karma points
    Apr 09, 2013 @ 13:10
    suzyb
    0

    Same problem.

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Apr 10, 2013 @ 07:59
    Richard Soeteman
    0

    Hi Suzy,

    Think I know what is causing this. The CMSImport FieldAdapter will also kick in and that will convert the value instead of your FieldAdapter. Only one FieldAdapter will be executed. CMSImport V3 will address that. So think it's best to modify the datasource before upload. I find it weird that it's adding new records every time since that should not happen at all.

    An alternative could be to not map the property and use the RecordImported event to assign the value. Check the manual for examples. Bit harder but would get the job done I think.

    Hope modifying the datasource helps solving the issue.

    Cheers,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft