Copied to clipboard

Flag this post as spam?

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


  • John C Scott 473 posts 1183 karma points
    Jun 01, 2011 @ 13:27
    John C Scott
    0

    Importing to uComponents XPath CheckBoxList

    First of two questions I'm thinking about, and I thought it made sense to break them into two posts.

    I'm clear that I need to write a FieldAdaptor and that is nicely documented thank you. Happy to share this when it's written too if i can write it generically enough.

    There's one problem that I can't think my way around at the moment with this, and any alternative ideas very much appreciated.

    The source of the control needs to come from more than one column.

    The source document is Excel CSV and has a column for each possible option, so it might look like this:

    Name,   Monday_breakfast, Monday_lunch, Monday_supper, Tuesday_breakfast, etc...
    John,   1,                1,            0,             1,      
    Paul,   0,                1,            1,             1,      
    George, 1,                1,            0,             1,      
    Ringo   1,                0,            0,             1,      

    Assuming monday_breakfast is node 1001, monday_lunch is 1002, then the rest 1003,1004 etc

    So the field adaptor will need to save something like (assuming comma delimited)

    John <meals>1001,1002,1004</meals>
    Paul <meals>1002,1003,1004</meals>
    George <meals>1001,1002,1004</meals>
    Ringo <meals>1002,1004</meals>

     

    SO the bit I can't work out is how to read more than one column into my field adaptor. If I use the same adaptor four times for each column and write to the same output field they will just overwrite each other, I need to somehow read all four column at once and save it to one generic property.

    DO you think this is possible?

     

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Jun 01, 2011 @ 21:04
    Richard Soeteman
    0

    Hi John,

    A FieldAdapter is per column. You can the Reecordimporting event for this I think. This gives you the document as a sender and the items collection holds a reference to all columns in the datasource. Then you can create the structrure that you want based on the items collection and add that value  to the document property directly.

    We have a long weekend in the Netherlands othwersise I would have the time to creat a sample. The event itself is documented in section 8.2.3.1 and a sample (not the same as you need, but it gives you info how to use the event is added in section 8.6)

    Hope this helps you for now.

    Thanks,

    Richard

  • Fergus Davidson 309 posts 588 karma points
    Jun 23, 2011 @ 18:37
    Fergus Davidson
    0

    Hi

    I need to do this exact same thing - multi columns into a uComponents XPath CheckBoxList.

    I can easily see how to combine my columns and import as CSV storage, BUT i would like to store as XML.

    How do i go about achieving this?

     

    Thanks

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Jun 23, 2011 @ 21:13
    Richard Soeteman
    0

    Hi,

    what I would do is look how Ucomponents stores this xml data in the CMSPropertyData table. The transform your data from the datasource to the required xml in the RecordImported  event and assign it to the desired column.

    Hope this puts you in the right direction,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft