Copied to clipboard

Flag this post as spam?

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


  • Michele 10 posts 90 karma points
    Mar 21, 2017 @ 16:26
    Michele
    0

    Usync and new PreValues

    Hi, I have a custom data type which is a CheckBoxList, representing a list of countries. I am using uSync so that the values are driven via code: if I need to add a new country, I add it in the country.config file (located in uSync\data\DataType...) and, at every deployment, when the app is restarted, the XML file is processed and the countries are kept in sync. The values for the countries ideally should be in alphabetical order.

    The requirement I have now is to add 2 new countries.

    Initially I was thinking to add them to the XML and amend the "Alias" values in the XML to set the desired order, but this is a wrong approach, because at every import, if there is a discrepancy between the Alias value stored in the DB and the Alias value in the XML, the DB record is updated by keeping the same Id but with the value coming from the XML, so all the content using that datatype will have a wrong value for the Country.

    Let's say that in the db I have:

    ID: 100 Alias: 5 Value: US

    If I change the Alias value in the XML, so that Alias: 5 correspond to Canada, after the import in the DB I'll have

    ID: 100 Alias: 5 Value: Canada

    So all the content that was tagged with "US" will be now tagged with "Canada". This is clearly not what I want.

    What I tried to do then was to revert back and add the new values at the bottom of the XML, with a value for the "Alias" that no other record is using, and then, after the import, using the UI to set the correct order. I noticed, though, that in doing this all the values for the Alias in the DB are reshuffled; I was expecting that only the sortorder column would have changed. This means that, at the next deployment, the countries in the db will have a different alias from the countries in the XML and this will cause the problem above.

    How can I add two new countries, in alphabetical order, without affecting the existing content, in a consistent way through different environments?

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Apr 01, 2017 @ 11:26
    Kevin Jump
    0

    Hi

    you are right when you change a checkbox list, the alias values will change, and this does mean the numbers in the background will have changed for all your values inside content.

    if you are also using usync content edition then you will need to re-export all content where the value might be set (so a full export might make sense) as this will produce new export files with the new IDs mapped for the values from the checkbox list.

    ordinarily you wouldn't need to do this, but as you point out this re-ordering does change the internal values fro the list - so you need to re-sync the content too.

Please Sign in or register to post replies

Write your reply to:

Draft