Copied to clipboard

Flag this post as spam?

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


  • Martin Lingstuyl 202 posts 379 karma points
    Mar 06, 2012 @ 18:19
    Martin Lingstuyl
    0

    Using Name column as Primary Key (About Relations)

    Hi Richard,

     

    Keeping busy with your (great) CMSImport Package.
    I'm running into the following: I've got an xml datasource that changes overtime, and gets imported everyday.

    Due to the changes, it is possible that the ID of the records change. If that happens, CMSImport cannot update the node, but creates a new one. (due to the relationmodel)

    I therefore changed the Primary Key to the Name within the XML record. This because the Name never changes.
    It seems to work, but do you maybe have experience with this? Is this method possible?

     

    In short: I want to link the name record in the xml to the NodeName, and based on the name update a node (or create a new node)

    Hope to hear from you.

    Martin

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Mar 06, 2012 @ 20:19
    Richard Soeteman
    0

    Hi Martin,

    Great that you like the package.Usually it's the name that change instead of the id? Are you using multiple datasources?  But it will work as long as you don't have duplicate names and you don't change the name.\

    Hope this helps,

    Richard

    PS: Just seen you work for a dutch company already member of the Umbraco Usergroup? http://www.linkedin.com/groups?home=&gid=3326363&trk=anet_ug_hm 

  • Martin Lingstuyl 202 posts 379 karma points
    Mar 06, 2012 @ 20:53
    Martin Lingstuyl
    0

    Hi Richard,

     

    great, I'll check it out! (the usergroup)

    No it's only one datasource, but this actually is a textfile export from a Shop Administration Software. This export does not have a primary key, and might change the order, so adding a key does not help.

     But it's easy, as soon as the name changes, I've written some code that deletes the old record, and adds a new one.

     

    Martin

     

Please Sign in or register to post replies

Write your reply to:

Draft