Copied to clipboard

Flag this post as spam?

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


  • Peter Cort Larsen 388 posts 922 karma points
    Jun 21, 2012 @ 15:48
    Peter Cort Larsen
    0

    ucomponents: Multiple textstring

    Hi,

    Can anyone help me loop items from ucomponents multiple textstring in code-behind?

    I can get values like this:

    string PropertyData = uQuery.GetDocument(childDoc.Id).GetProperty<string>("checkboxOptions");

    <pages>
    <page title="PageTitle" nodeid="1230" PropertyData="Anticipate environmental litigation License to operate Follow legislation Other law requirement Resource Shortage"/>
    </pages>

    I am building a xml output used in a /base call.

    I want each item in PropertyData added as a node in <page> like this

    <node>Anticipate environmental litigation</node>
    <node>License to operate</node>
    <node>Follow legislation</node>
    <node>Other law requirement</node>
    <node>Resource Shortage
    </node

     

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Jun 21, 2012 @ 15:55
    Lee Kelleher
    0

    Hi Peter,

    When taking the Multiple Textstring data from a Document (e.g. from the database, not the XML cache), each line is delimited by a newline.

    You could use string.Split to loop through each line?

    string PropertyData = uQuery.GetDocument(childDoc.Id).GetProperty<string>("checkboxOptions");
    foreach (var line in PropertyData.Split('\n'))
    {
        // use 'line' to build up your XML
    }

    Cheers, Lee.

  • Peter Cort Larsen 388 posts 922 karma points
    Jun 21, 2012 @ 16:13
    Peter Cort Larsen
    0

    Thanks Lee, it worked.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies