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:
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.
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)
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.
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:
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)
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?
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
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
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
is working on a reply...