Line Break in XML?

When I use "<br>" within my XML database, I get this
error:
"Expected end of tag 'br'(9,43)"
I have tried <br>, </br>, <br></br>
and searched... but haven't yet found a solution.
Should I be using some kind of hex code?
Thanks in advance for the assistance!
Dan

I spent a whole bloody day trying to solve this one!  Thanks for the advice here guys....
Here's the "How to..." instructions I made for myself (I will need this later as a function of age)....
Inserting <br /> line breaks in XML content:
It's necessary to add a line of code directly after the dataset at the top of the (spry) htm page that sets the columnType:
var dsRegInfoElem = new Spry.Data.XMLDataSet("regisinfo.xml", "sites/level1/site",{distinctOnLoad:true});
dsRegInfoElem.setColumnType('datetime','html');<!--This line is necessary for the line breaks in the xml CDATA sections to work-->
Make sure the xml tag that will contain the CDATA wrap is identified (here it's the <datetime> tag).
Then, in the XML file, add the CDATA wrap just inside the tag like this:
<datetime><![CDATA[texttexttexttext]]></datetime>
Now just insert the <br /> where I need it!
<datetime><![CDATA[texttext<br />texttext]]></datetime>

Similar Messages

  • Line Break for XML File

    All,
    I am able to generate xml file from an internal table. The problem is, if I open the file in IE everything looks good. When I open it in notepad or notepad++, everything is in one line. Can you tell me how to generate a line break after each tags.
    Please find the following code used by me for reference.
    LOOP AT lt_ohd INTO ls_ohd.
        ls_temp_ohd = ls_ohd.
        AT FIRST.
          l_ixml = cl_ixml=>create( ).
          l_document = l_ixml->create_document( ).
          l_element_ohd  = l_document->create_simple_element(
                      name = 'OHD'
                      parent = l_document ).
        ENDAT.
        AT NEW cc.
          CLEAR : lv_inhaltskom, lv_text.
          lv_inhaltskom = ls_temp_ohd-cc.
          CALL FUNCTION 'ISM_SELECT_TEXT_JJTIKO'
            EXPORTING
              pv_inhaltskom = lv_inhaltskom
            CHANGING
              pv_langtext   = lv_text.
          TRANSLATE lv_text TO UPPER CASE.
          l_value = lv_text.
          l_element_county  = l_document->create_simple_element(
                      name   = 'city_county'
                      value  = l_value
                      parent = l_element_ohd  ).
        ENDAT.
        AT NEW order.
          l_element_neighborhood  = l_document->create_simple_element(
                      name    = 'entry'
                      parent  = l_element_county  ).
        ENDAT.
        l_value = ls_temp_ohd-neighborhood.
        l_element_address  = l_document->create_simple_element(
                    name   = 'neighborhood'
                    value  = l_value
                    parent = l_element_neighborhood ).
        l_value = ls_temp_ohd-address_detail.
        l_element_address  = l_document->create_simple_element(
                    name   = 'address_detail'
                    value  = l_value
                    parent = l_element_neighborhood  ).
        l_value = ls_temp_ohd-order.
        l_element_address  = l_document->create_simple_element(
                    name   = 'order'
                    value  = l_value
                    parent = l_element_neighborhood  ).
        l_value = ls_temp_ohd-item.
        l_element_address  = l_document->create_simple_element(
                    name   = 'item'
                    value  = l_value
                    parent = l_element_neighborhood  ).
        l_value = ls_temp_ohd-cc.
        l_element_address  = l_document->create_simple_element(
                    name   = 'cc'
                    value  = l_value
                    parent = l_element_neighborhood  ).
        l_value = ls_temp_ohd-address.
        l_element_address  = l_document->create_simple_element(
                    name   = 'address'
                    value  = l_value
                    parent = l_element_neighborhood  ).
        l_value = ls_temp_ohd-price.
        l_element_address  = l_document->create_simple_element(
                    name   = 'price'
                    value  = l_value
                    parent = l_element_neighborhood ).
        l_value = ls_temp_ohd-bed.
        l_element_address  = l_document->create_simple_element(
                    name   = 'bed'
                    value  = l_value
                    parent = l_element_neighborhood  ).
        l_value = ls_temp_ohd-bath.
        l_element_address  = l_document->create_simple_element(
                    name   = 'bath'
                    value  = l_value
                    parent = l_element_neighborhood  ).
        l_value = ls_temp_ohd-opentime.
        l_element_address  = l_document->create_simple_element(
                    name   = 'opentime'
                    value  = l_value
                    parent = l_element_neighborhood  ).
        l_value = ls_temp_ohd-state.
        l_element_address  = l_document->create_simple_element(
                    name   = 'state'
                    value  = l_value
                    parent = l_element_neighborhood ).
        l_value = ls_temp_ohd-zip.
        l_element_address  = l_document->create_simple_element(
                    name   = 'zip'
                    value  = l_value
                    parent = l_element_neighborhood ).
        l_streamfactory = l_ixml->create_stream_factory( ).
        l_ostream = l_streamfactory->create_ostream_itable( table = lt_xml_table ).
        l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                              document = l_document ).
        l_rc = l_renderer->render( ).
        l_xml_size = l_ostream->get_num_written_raw( ).
      ENDLOOP.
    Regards,
    Salil
    Edited by: salil vaidya on Jan 18, 2011 2:34 PM

    Thanks.
    But now, I have a syntax error.
    BEGIN OF xml_line,
              data(256) TYPE x
    END OF xml_line.
    DATA: lt_xml_table      TYPE TABLE OF xml_line,
          ls_xml_table      TYPE xml_line.
    LOOP AT lt_xml_table INTO ls_xml_table.
        CONCATENATE ls_string cl_abap_char_utilities=>cr_lf INTO ls_string.
        MODIFY lt_xml_table FROM ls_xml_table INDEX sy-tabix.
        CLEAR : ls_xml_table, ls_string.
      ENDLOOP.

  • Creating a line break in xml?

    Using dreamweaver cs3 I have created a spry table that is connected to a spry accordian with a detailregion where the accordian shows additional data pulled from a mutual xml file.  Everything works very well.   The problem I have is that some of the text in the xml file is 2 separate paragraphs and I can't find a way to insert a paragraph break in the xml. It all comes out as one paragraph of text.  ugh  I got it to print <p> using escape characters &lt: etc but it would actually print out the <P> and not respond to the html tag.  lol  There must be a way to insert a simple paragraph break but I can't find anything that shows how to do that. Any help would be very much appreciated.
    Thanks
    mrtom

    Thanks very much Donald.  I fear I am a newbie and still a bit confused.  I tried the CDATA solution
    and that ended  up simply printing the html on the accordian page in the same way it did when I used the escape
    characters.  The other solution listed on the page you linked says:
    "To fix this, we have to entity decode the "description" column value  of each row so that when Spry re-generates the spry:region, it inserts  the entity decoded version of the HTML markup. The result of this  pre-processing allows the HTML markup to appear properly:"
    When they say "description" column what are they referring to?  Sounds like they are referring to a database row but my data is from a simple and small hand-written xml file.  I'm not sure what I need to do here?   Thanks for any guidance you might offer.
    Tom

  • SAP PI 7.3.1 XML line break within node

    Good Morning All,
    I've an issue with link breaks in XML. Basically, the scenario is IDoc (SAP) to File (XML 3rd Party System).
    I've mapped a text field from the IDoc to the XML node (<comments>) .  The text data comes across with a delimiter !$! to indicate where a line break should occur within the <comment>  node in the XML
    For example the text line comes across in the IDoc as  line 1!$!This is Line 2!$! this one is line 3!$!  and within the xml file I need to the <comment> node to look like  <comment>line 1
                                       This is line 2
                                       this one is line 3</comment>
    We need this for formatting in the 3rd party system. I've tried various replaces etc. but the new line never seems to get recognized. 
    Any help with this would be very much appreciated.
    Thanks
    G

    Use OS specific new line character by using System.getProperty("line.separator"):
    Here is complete code:
    UDF with Context option
    Parameters:String var[], ResultList result)
    String temp[] = var[0].split("!$!");
    for(int i = 0; i < temp.length; i++)
         result.addValue(temp[i] + System.getProperty("line.separator"));
    Check it should work, I have not tested...
    --Divyesh

  • Remove line breaks within a xml element

    Hi,
    I have a xml element that contains a long text string with multiple line breaks. something like this:
    text
    text
    text text
    text
    text text text
    text
    How can I remove all line breks except one, i e I still want a line brek after each text line:
    text
    text
    text text
    text
    text text text
    text
    Thanks for you help!
    Magnus

    This is a media object (BLOB) in a JDE report. But we have now modified the report to get the xml file correct from start instead.
    /Magnus

  • VSTO: How to set line break in Ribbon Xml?

    Hi All,
    I have a button in Ribbon.xml. it looks like:
            <group label="myLabel" id="View">
              <checkBox id="cbView" label="ViewViewviewviewview" getPressed="cbView_Pressed"/>
            </group>
    The result is shown as:
    The checkbox is too long. My question is : How to set line break in checkbox's label.
    Thanks a lot,
    By the way, in Ribbon Xml. How to add RadioButton?

    Hello Ricky,
    The Fluent UI (aka Ribbon UI) doesn't provide any attribute or callback for that. You can try to use an escape sequence "\n\r", but I am not sure whether it helps. Also you may consider placing a text block below the check box control.
    You can read more about the Ribbon UI in the following series of articles:
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

  • When exporting XML files, I get forced line breaks before and after my xmltag

    hi everybody,
    as I said, i do a javascritp that exports xml files. First I clean up my text by removing every invisible characters with app.findpreferences. Nevertheless, my xml files is almost well formed beacause i got before and after each xmltag a forced line break. Somebody could explain to me why ?
    I don't use prettyIndent and prettyPrinting .
    Best regards
    Américo Pinto

    hi everybody,
    as I said, i do a javascritp that exports xml files. First I clean up my text by removing every invisible characters with app.findpreferences. Nevertheless, my xml files is almost well formed beacause i got before and after each xmltag a forced line break. Somebody could explain to me why ?
    I don't use prettyIndent and prettyPrinting .
    Best regards
    Américo Pinto

  • Handling Line breaks in Oracle XML Publisher

    Hi,
    I’m developing a XML Publisher report.The data definition file has a tag which contains line breaks(\n- new line).
    How to handle this logic in RTF template?
    For Example:
    XML tag:
    <CF_LONG_TEXT>Final Adjusted Total Costs: $0.00 \n Less: Initial Billing Amount - $(1.65) - Invoice # 100000 \n \n Final Billing Amount: $0.88 \n \n Computation: \n a) Adjusted Number of Full-Time Students: 2,877 </CF_LONG_TEXT>
    Desired Output:
    Final Adjusted Total Costs: $0.00
    Less: Initial Billing Amount - $(1.65) - Invoice # 100000
    Final Billing Amount: $0.88
    Computation:
    a) Adjusted Number of Full-Time Students: 2,877
    Thanks,
    Sri.

    Hi,
    Please try giving this:
    <xs:attribute name="space" default="preserve">
                          <xs:simpleType>
                              <xs:restriction base="xs:NCName">
                                 <xs:enumeration value="default"/>
                                 <xs:enumeration value="preserve"/>
                               </xs:restriction>
                          </xs:simpleType>
                    </xs:attribute>
    Regards
    Suraj

  • I need to find all XML elements and add a line break to the text of each of them

    I need to find all XML elements and add a line break to the text of each of them.
    Is this possible with a script?

    I need to go from this ...
    to this...
    but looking for the XML elements (not paragraphs) and then adding text ...
    Thanks for your attention !!!

  • XML and line breakes

    I have ab XML like this
    <node>
    <child>Erat enim gulae deditus, cuius deus venter
    fuit. Nullumque sibi adserebat
    esse prudentiorem.
    </child>
    </node>
    I load the xml into flash in a dynamic textbox. The problem
    is that I get double line breakes:
    Erat enim gulae deditus, cuius deus venter fuit. Nullumque
    sibi adserebat
    esse prudentiorem.
    What is the problem?
    /E

    Do I have to parse the loaded text maybe?
    /E

  • File adapter-How to set line break in text file-split record into two lines

    Dear Guru's,
    I have to solve following problem with XML (with mulitiple records) to TEXT file scenario using file adapter. I have to output for ever ONE data record in XML always two identical lines in text file. Second line should have a little bit different mapping in few fields like date,... So I did duplicate fileds in my output structure in mapping and need to know how to set line break in the middle and see half of structure in first line and next structure half in second line
    My output structure in mapping is:
    CASHFLOW
    - INTERFACE
    - GESELLSCHAFT
    - ANWENDUNG
    - PRODUKT
    - VERTRAG
    - BETRAG
    - WAEHRUNG
    - DIRECTION
    - BEWEGUNGSTYP
    - FAELLIGKEIT
    - ZINSFESTSTELLUNG
    - ZAHLUNGSTAG
    - RENDITE
    - INTERFACE2
    - GESELLSCHAFT2
    - ANWENDUNG2
    - PRODUKT2
    - VERTRAG2
    - BETRAG2
    - WAEHRUNG2
    - DIRECTION2
    - BEWEGUNGSTYP2
    - FAELLIGKEIT2
    - ZINSFESTSTELLUNG2
    - ZAHLUNGSTAG2
    - RENDITE2
    Question is how can I set on receiving file adapter in Content Conversion Parameters that fields from first structure half INTERFACE...RENDITE should be outputed in one line and fields from second half of structure INTERFACE2...RENDITE2 should start on second line in final text file.
    I'm getting at the moment one line only and I need to know how can set line break so that second line starting with INTERFACE2(CA)...RENDITE2 will start in new line.
    CA,"0100","7","512",20090127010001,-12454762586.6800,"EUR",2,12,2009-01-28,2009-01-27,2009-01-28,"0.0000000",CA,"0100","7","512",20090127010001,-12454762586.6800,"EUR",1,10,2009-01-27,2009-01-27,2009-01-27,"0.0000000"
    This should be final output:
    CA,"0100","7","512",20090127010001,-12454762586.6800,"EUR",2,12,2009-01-28,2009-01-27,2009-01-28,"0.0000000"
    CA,"0100","7","512",20090127010001,-12454762586.6800,"EUR",1,10,2009-01-27,2009-01-27,2009-01-27,"0.0000000"
    My file adapter settings:
    RecordsetStructure=CASHFLOW
    CASHFLOW.fieldNames=INTERFACE,GESELLSCHAFT,ANWENDUNG,PRODUKT,VERTRAG,BETRAG,WAEHRUNG,DIRECTION,BEWEGUNGSTYP,FAELLIGKEIT,ZINSFESTSTELLUNG,ZAHLUNGSTAG,RENDITE
    CASHFLOW.fieldSeparator=,
    CASHFLOW.endSeparator='nl'
    CASHFLOW.fieldNames=INTERFACE2,GESELLSCHAFT2,ANWENDUNG2,PRODUKT2,VERTRAG2,BETRAG2,WAEHRUNG2,DIRECTION2,BEWEGUNGSTYP2,FAELLIGKEIT2,ZINSFESTSTELLUNG2,ZAHLUNGSTAG2,RENDITE2
    CASHFLOW.fieldSeparator=,
    It wont help if I add two identical structures in mapping because in output i would see for multiple entries section with first lines only and after that section with second lines only. And CASHFLOW is one part of more complex mapping ...
    (This is final output structure RecordsetStructure=HEADER,CASHFLOW,CONDITION,REFERENCE,CONTRACT - more sections with different data and all these should have duplicate lines at the end)
    Thanks a lot for any help
    Cheers
    Marian
    Edited by: Marian  Luscon on Jul 14, 2009 11:44 AM

    Hi Ivan,
    right, I did test just for sure.
    Putting constant 'nl' into field CASHFLOW-INTERFACE1 didnt help - still getting one line instead two lines.
    CA ,"0100" ,"7" ,"512" ,20090127GTP101 ,-12454762586.6800 ,"EUR" ,2 ,12 ,2009-01-28 ,2009-01-27 ,2009-01-28 ,"0.0000000" ,'nl' ,"GTP1" ,"7" ,"512" ,20090127GTP101 ,-12454762586.6800 ,"EUR" ,1 ,10 ,2009-01-27 ,2009-01-27 ,2009-01-27 ,"0.0000000"
    So there is still question. Is there any way (mapping,...) how to output always 2 lines in text file for one record in XML. It always does 1 record in mapping structure = 1 line but we need 2 lines ...
    Example:
    Input: 4 records in XML
    Output: 8 lines in final text file ...
    Thanks to you all guys
    Marian

  • How to insert new line break in XSLT mapping

    Hi experts,
    I am doing file to mail scenario, i am sending the text file as an attachment using reciever mail adapter.
    I did everything, i can able to send the mail with text file attachment, but with in the file i got multiple rows, i need to put line break in XSLT mapping.
    I did use following statement but it is inserting small rectangle between the records, the records are not separating with new lines, all are in one line.
    <xsl:text>*#xA;</xsl:text>   
    note: in real coding replace * with &
    Can anyone suggest me how to insert new line in XSLT mapping.
    My XSLT mapping as look like:
    <?xml version='1.0'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ns0="http://www.Coj.co.za/SapIsuToABSA/DirectDebitFile">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:variable name="break">&lt;br/&gt;</xsl:variable>
    <xsl:variable name="space"> </xsl:variable>
    <xsl:variable name="newline"><xsl:text></xsl:text></xsl:variable>
    <xsl:template match="/">
    <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
    <Subject>Please Check Attached Direct Debit File</Subject>
    <From>S@za</From>
    <To>P@za</To>
    <Content_Type>text/plain</Content_Type>
    <Content>
    <xsl:for-each select="MT_SapIsuToABSA_DirectDebitFile/DirectDebitRec/Body">
    <xsl:value-of select="Space1"/>
    <xsl:value-of select="Cust_AccNo"/>
    <xsl:value-of select="Reserve_1"/>
    <xsl:value-of select="Cust_Name"/>
    <xsl:value-of select="Cust_Name1"/>
    <xsl:value-of select="Cust_Bank_AccNo"/>
    <xsl:value-of select="Space2"/>
    <xsl:value-of select="Cust_Bank_BranchNo"/>
    <xsl:value-of select="Reserve_2"/>
    <xsl:value-of select="Space3"/>
    <xsl:value-of select="Cust_AccNo_1"/>
    <xsl:value-of select="Space4"/>
    <xsl:value-of select="Reserve_3"/>
    <xsl:value-of select="Deduction_Amnt"/>
    <xsl:value-of select="Space5"/>
    <xsl:value-of select="Reserve_4"/>
    <xsl:value-of select="Space6"/>
    <xsl:value-of select="Action_Date"/>
    <xsl:value-of select="Space7"/>
    <xsl:value-of select="Reserve_5"/>
    <xsl:text>*#xA;</xsl:text>   
    note: in real coding replace * with &
    </xsl:for-each>
    </Content>
      </ns1:Mail>
      </xsl:template>
      </xsl:stylesheet>
    Kind regards,
    Praveen

    Hi,
    I think <xsl:text>#xa;</xsl:text> should do the trick, but depending on which OS (ux or win), the "new line" chars sequence is different (win would require a CRLF like <xsl:text>#xd;*#xa;</xsl:text>)
    Chris
    -> &
    Edited by: Christophe PFERTZEL on Apr 14, 2010 2:16 PM

  • Output with line breaks seemingly randomly placed

    Hola -
    I've adapted Tyler Muth's RSS feed article (http://tylermuth.wordpress.com/2008/01/22/producing-rss-from-plsql/) for the most part successfully; however, my output has breaks in the lines at inappropriate places, often in the mddle of an XML element tag for example. The placement of the breaks varies if I change the values of l_idx, l_len, l_defrows, l_maxrows, and l_desclen, but the breaks persist. They're not reflected in the code below but I've added the utl_file.fflush to no good effect.
    Examples of broken output:
    <pre>
    <title>Three
    prehistoric inventions that shaped us /</title>
    <guid
    isPermaLink="false">226402455778123622</guid>
    <pubDate>Thu, 04 Aug 2011 12:36:22
    EST</pubDate>
    <guid isPermaLink="fal
    se">220922455778123622</guid>
    <item
    >
    </pre>
    It's a lot of data so I won't post it here, but here's the code & the table; any ideas as to where to start investigating will be greatly appreciated.
    Code:
    create or replace
    PROCEDURE "RSSLOOP3" ( fund_in IN VARCHAR2, fund_in2 IN VARCHAR2 := 'XXX')
    is
    -- customizable parameters
    l_title varchar2(255) := ' New Titles Since ' || to_char(sysdate - 90, 'MM/DD/YYYY');
    l_link varchar2(255) := 'replace this' || fund_in || '.rss';
    l_description varchar2(255) := 'This is a feed of changes to items ' || fund_in;
    l_language varchar2(255) := 'en-us';
    -- end customizable parameters
    l_version varchar2(10) := '2.0';
    l_clob clob;
    l_idx pls_integer := 1;
    l_len pls_integer := 255;
    l_defrows pls_integer := 100;
    l_maxrows pls_integer := 100;
    l_desclen pls_integer := 250;
    -- for output to file
    fh UTL_FILE.FILE_TYPE;
    path VARCHAR2(30);
    filename VARCHAR2(30);
    begin
    path := '/http/live/screens/rss/';
    filename := fund_in || '.rss';
    fh := UTL_FILE.FOPEN(path, filename, 'w');
    for i in (
    select xmlelement( "rss",
    -- Begin XML Header Block
    xmlattributes( l_version as "version"),
    xmlelement( "channel",
    xmlforest( l_title as "title",
    l_link as "link",
    l_description as "description",
    l_language as "language"),
    -- End XML Header Block
    -- Begin List of Individual Articles or Items
    xmlagg(
    xmlelement( "item",
    xmlelement("title", x.title),
    xmlelement("link", x.link),
    xmlelement("description", convert(x.description, 'UTF8', 'AL32UTF8')),
    xmlelement("callnum", x.callnum),
    xmlelement("pubDate", to_char(x.updated_on,'Dy, DD Mon RRRR hh24:mi:ss')),
    xmlelement("guid", XMLATTRIBUTES('false' as "isPermaLink"),x.id||to_char(x.updated_on,'JHH24MISS'))
    -- End List of Individual Articles or Items
    ) as result
    from ( -- Actual Database Query that populates the list of Items
    select id,title,link,description,updated_on, callnum
    from drx_rss_feeds
    where (fund like fund_in||'%')
    and rownum < (l_maxrows+1)) x)
    loop
    l_clob := xmltype.extract(i.result,'/').getclobval;
    exit;
    end loop; --i
    --- OUTPUT RESULTS
    for i in 1..ceil(dbms_lob.getlength(l_clob)/l_len) loop
    UTL_FILE.PUT_LINE(fh,(substr(l_clob,l_idx,l_len)));
    l_idx := l_idx + l_len;
    end loop; --i
    UTL_FILE.FCLOSE(fh);
    end rssloop3;
    Table:
    CREATE TABLE "DRX_RSS_FEEDS"
    "ID" VARCHAR2(32 BYTE),
    "TITLE" VARCHAR2(255 BYTE),
    "DESCRIPTION" VARCHAR2(4000 BYTE),
    "LINK" VARCHAR2(1000 BYTE),
    "AUTHOR" VARCHAR2(255 BYTE),
    "UPDATED_ON" DATE,
    "CALLNUM" VARCHAR2(255 BYTE),
    "FUND" VARCHAR2(10 BYTE)
    )

    Or have a look at the Oracle Documentation, for instance at the parameters for utl_file.fopen
    max_linesize Maximum number of characters for each line, including the
    newline character, for this file (minimum value 1, maximum
    value 32767). If unspecified, Oracle supplies a default value of
    1024.It wouldn't surprise me if your randomly placed line breaks are all 1023 characters a part.
    Anton

  • Convert rows to columns and put line break in between using t-sql

    Hi,
    I have a table with 5 columns..and my source data looks like this..
    RecordID  ID    Display          AddressType   EmailAddress
        1           1      GeneratedBy       From           
    [email protected]
        1           1      ReceivedBy         To               
    [email protected]
        1           1      ReceivedBy         To              
    [email protected]
        2           1
        3           1      GeneratedBy       From         
    [email protected]
        3           1      GeneratedBy       From          [email protected]
        3           1      ReceivedBy         To             
    [email protected]
    I need  t-sql to show output as..
    RecordID   ID    FullDisplay
       1       1     GeneratedBy  From -
    [email protected]  < CHAR(13) - Need Line Break here so that it goes to 2nd line>
                       ReceivedBy   To   - 
    [email protected] ; To -
    [email protected]
       2       1      Null
       3       1      GeneratedBy From -
    [email protected] ; From -
    [email protected]  < CHAR(13) - Need Line Break here so that it goes to 2nd line>
                      ReceivedBy  To   -
    [email protected]
    Display field will have 3 values - "GeneratedBy" , "ReceivedBy"  or Null
    AddresType field will have  3 values - "From" , "To" and Null.
    In the above example, Those 7 records belongs to ID=1.
    Whenever RecordID is same I want to show everything in one line with line breaks in between.
    In the above example RecordID=1 has 3 rows, display it as 1 row. But Whenever 'ReceivedBy' is there for same recordID put a line break before "ReceivedBy"
    create Statement:
    Create Table SampleTest
    (RecordID int null, ID int null , Dispplay varchar(20) null, AddressType varchar(6) null , EmailAddress Varchar(25) null)
    Insert Statement:
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'ReceivedBy','To','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'ReceivedBy','To','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (2,1,  Null,Null,Null)
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'ReceivedBy','To','[email protected]')
     Thanks!
    sql

    Try below
    drop table SampleTest
    GO
    Create Table SampleTest
    (RecordID int null, ID int null , Display varchar(20) null, AddressType varchar(6) null , EmailAddress Varchar(25) null)
    --Insert Statement:
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'ReceivedBy','To','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'ReceivedBy','To','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (2,1, Null,Null,Null)
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'ReceivedBy','To','[email protected]')
    with CTE1 as
    select ROW_NUMBER() over(PARTITION by RecordID ,ID,Display order by EmailAddress)rno,* From SampleTest
    ), CTE2 as (
    select RecordID ,ID,'GeneratedBy '+ STUFF(( SELECT '; From - ' + EmailAddress AS [text()]
    FROM CTE1 b
    WHERE
    a.RecordID=b.RecordID and a.ID=b.ID and b.Display = 'GeneratedBy'
    FOR XML PATH('')
    ), 1, 2, '' ) GeneratedBy,
    'ReceivedBy '+ STUFF(( SELECT '; To - ' + EmailAddress AS [text()]
    FROM CTE1 b
    WHERE
    a.RecordID=b.RecordID and a.ID=b.ID and b.Display = 'ReceivedBy'
    FOR XML PATH('')
    ), 1, 2, '' ) ReceivedBy
    From CTE1 a
    group by RecordID ,ID
    select RecordID ,ID,GeneratedBy +CHAR(13)+ ReceivedBy as FullDisplay from CTE2
    Thanks
    Saravana Kumar C

  • Inserting line break within label

    Hey guys,
    i've run into a small problem with the coding. right now im
    creating image viewer within a horizontal list. at first, i had
    each object coded inside the horizontal list but then i decided to
    place everything in an xml file to make changes easier. since i've
    switched, i have not been able to figure out how to insert a line
    break for each label. this is what the code looked like when i was
    naming each object.
    <mx:HorizontalList id="PosterSelect" height="352"
    columnCount="3" columnWidth="200" width="580"
    rollOverColor="#ff3344" themeColor="#DC240B"
    itemClick="itemClicked(event)">
    <mx:dataProvider>
    <mx:Array>
    <mx:Object id="object1" label="March 12, 2008&
    #13;Chicago, IL" data="events"/>
    <mx:Object id="object2" label="March 12, 2008&
    #13;Chicago, IL" data="events"/>
    <mx:Object label="March 12, 2008& #13;Chicago, IL"
    icon="{event3}" data="events"/>
    <mx:Object label="March 12, 2008& #13;Chicago, IL"
    icon="{event4}" data="events"/>
    <mx:Object label="March 12, 2008& #13;Chicago, IL"
    icon="{event5}" data="events"/>
    </mx:Array>
    </mx:dataProvider>
    </mx:HorizontalList>
    within the label property, i used the & #13; character to
    insert a line break. now im using an item renderer to call the
    information from my xml file. the problem is... i cannot figure out
    how to insert a line break like i did previously. from what i
    understand... the text in the label field of the xml file is
    already parsed when it comes into flex. so using the & #13; or
    \n characters will not work. i also tried hitting enter to insert a
    new line in the xml file but that did not work either. does anyone
    know how i could work around this?? below is my current code and
    xml
    <eventinfo>
    <events>
    <label>March 12, 2008#13;Chicago, IL</label>
    <group>group name</group>
    <location>Detroit, MI</location>
    <icon>posters/event1.png</icon>
    <fullsize>posters/event1.png</fullsize>
    </events>
    <events>
    <label>March 12, 2008#13;Chicago, IL</label>
    <group>group name</group>
    <location>Detroit, MI</location>
    <icon>posters/event4.png</icon>
    <fullsize>posters/event1.png</fullsize>
    </events>
    </eventinfo>
    <mx:HorizontalList id="HorizontalCanvas" height="337"
    columnWidth="180" width="672"
    rollOverColor="#ff3344" themeColor="#DC240B"
    itemClick="callJavaScript()" x="10" y="33" borderStyle="solid"
    dataProvider="{eventinfo.events}" borderColor="#000000">
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox width="100%" height="350"
    horizontalAlign="center">
    <mx:Image source="{data.icon}"/>
    <mx:Label text="{data.label}"/>
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:HorizontalList>

    hey atta,
    sry, i was using the &#13; character but for some reason
    when i posted the character it turned into a space so i added the
    space inbetween the & and the #13;
    but yea i think it was the height... changed it to 40 and it
    worked.. i cant believe i didnt notice that lol... oh well... thx
    for the help!!!

Maybe you are looking for

  • Problem in JDBC-SQL Server connection string

    Anyone could help me to write proper connection string using JDBC with SQL Server 2000. The descp: Server name: CD databaseName: songs Using Window NT authentication. I dont know whether to include username and password. When I executed the statement

  • System restore and no more music

    Arlight, so last night I had to erase my computer completely. Now I'm in the process of reinstalling some necessary programs, such as iTunes. I have all of my music on my ipod already, it's just not in my library. I read the earlier question whose an

  • Digital scanning and backups online?

    My post is not, strictly speaking, about using Snow Leopard. But that's what I'm using and this forum comes closest to my question. The recent gas line explosion in San Bruno, CA (where houses were destroyed in a matter of seconds) made me think agai

  • How to insert into XSL simbols "&","&"," "?

    Hello! I use java xml parser v2_0_2_6 in JDK-1.2.2_005 on Sun Solaris 2.7. XSL: <xsl:text disable-output-escaping="yes"> &;nbsp; </xsl:text> Output: &nbsp; Such result for use [CDATA ...] content. Why "&" and "&" transform into "&"? null

  • SQL Server Performace After Restart

    Hi Guys: We do restart our sql servers once every month to make sure fail over clustering works.Lately we have seen that performance is pretty bad after the restarts.I am convinced its bad idea to restart the box as everything that is cached gets flu