Need to count number of non-empty (not null) occurrences for an element in XML

Hello,
    I have some XML data stored in a CLOB, there is a fragment shown below:
<ADDR>
<AutoNameOfOrganisation>2nd Image</AutoNameOfOrganisation>
<AutoLine1>105 Risbygate Street</AutoLine1>
<AutoLine2> </AutoLine2>
<AutoLine3> </AutoLine3>
<AutoU40.16>BURY ST. EDMUNDS</AutoU40.16>
<AutoStateOrCounty>Suffolk</AutoStateOrCounty>
<AutoU40.13>IP33 3AA</AutoU40.13>
<AutoU40.14>UNITED KINGDOM</AutoU40.14>
</ADDR>
<ADDR>
<AutoNameOfOrganisation></AutoNameOfOrganisation>
<AutoLine1>2 2nd Avenue</AutoLine1>
<AutoLine2> </AutoLine2>
<AutoLine3> </AutoLine3>
<AutoU40.16>HULL</AutoU40.16>
<AutoStateOrCounty>East Riding of Yorkshire</AutoStateOrCounty>
<AutoU40.13>HU6 9NT</AutoU40.13>
<AutoU40.14>UNITED KINGDOM</AutoU40.14>
</ADDR>
   What I would like to do is to be able to look at the whole of the xml and derive a count for a particular element where there is data .
   In the above case <AutoNameOfOrganisation> is not null in the first record and null in the second whilst <AutoLine3> is null in both records, so I'd like the counts to be 1 for <AutoNameOfOrganisation> and 0 for <AutoLine3>.
   The reason for this is so that I can avoid showing a column in a report if there is no data for that particular column in the results.
   I'm using Oracle 11G.
Thanks for any help,
Chris

Here's one way :
select count(AutoNameOfOrganisation)
     , count(AutoLine3)
from my_table t
   , xmltable(
       '/root/ADDR'
       passing xmlparse(document my_clob)
       columns AutoNameOfOrganisation varchar2(30) path 'normalize-space(AutoNameOfOrganisation)'
             , AutoLine3              varchar2(30) path 'normalize-space(AutoLine3)'
     ) x ;
In your sample fragment there's no root element so I've added one to test the query (though it's also possible to work with real XML fragments).
You may also omit normalize-space() calls if empty nodes are really empty. In your sample, there's a whitespace so I've added the function to strip it off.

Similar Messages

  • My MacBook Pro was stolen last night. I need the serial number. It is not showing up on my devices list. My iPads and iPhones are. I have used it to to sync my phones and pads as well having it registered with apple. Any thoughts? Thanks

    My MacBook Pro was stolen last night. I need the serial number. It is not showing up on my devices list. My iPads and iPhones are. I have used it to to sync my phones and pads as well having it registered with apple. Any thoughts? Thanks

    Click here: https://supportprofile.apple.com/MySupportProfile.do
    SIgn in with your Apple ID, the same one you used to access this support forum.
    Hopefully, you will see a list of all the devices you registered with your Apple ID, including their serial numbers. Let me know how this works out.
    Edit to add: If you enabled "find my imac" on your Pro, you ought to be able to remotely lock it, or even wipe its memory. Click http://www.icloud.com/ sign in with your Apple ID and click the big green "find my iPhone" icon (nevermind the name, it will find all your devices provided they're running Lion or iOS 5).
    Then file a police report and nail the b*****d.

  • To count number of records in an internal table for a condition

    Hello All,
            I want to count number of records in an internal table for a condition.
    For e.g. -- I have one internal table IT which having fields F1, F2, F3, F4, F5.
                     Now, I want number of records in itnternal table IT where F1 = 'ABC'.
    Is it possible to do..?? If yes, then how.??
    Thanks in advance...!!
    Regards,
    Poonam.

    Hi,
    If you mean an internal table, there are a few ways to do this.
    1 One would be to loop over the table with a WHERE clause and increment a counter.
    data: lv_counter type i.
    clear lv_counter.
    loop at itab where fld1 = 'ABC'.
    lv_counter = lv_counter + 1.
    endloop.
    lv_counter now has the number of rows per the condiction.
    2  Well, you may want to try this as well, and compare to the LOOP way. Not sure what kind of overhead you may get doing this way. Here ITAB is our main internal table, and ITAB_TMP is a copy of it. Again I think there may be some overhead in doing the copy. Next, delete out all records which are the reverse of your condition. Then whatever is left is the rows that you want to count. Then simply do a LINES operator on the internal table, passing the number of lines to LV_COUNT.
    data: itab type table of ttab.
    data: itab_tmp type table of ttab.
    itab_tmp[] = itab[].
    delete table itab_tmp where fld1  'ABC'.
    lv_count = lines( itab_tmp ).
    Thanks & Regards,
    ShreeMohan

  • I need to upgrade to 10.9 but not 10.10 for Adobe Connect 9.3. I can't find 10.9 in the App Store.  Where can I find it?

    I need to upgrade to 10.9 but not 10.10 for Adobe Connect 9.3. I can't find 10.9 in the App Store.  Where can I find it?

    Hi ..
    Make sure your Mac can run Mavericks >  OS X Mavericks: System Requirements
    v10.9 Mavericks no longer available from the App Store but may be able to acquire a redemption code from Apple via email.
    Open the App Store. Select either Features, Top Charts, or Categories in the menu top of the window.
    Then click Support under Quick Links right of the App Store window then click Contact Support.
    Once you have the redemption code, click Redeem under Quick Links.

  • SQL 7 - Oracle 8i - NOT NULL dropped for IDENTITY column

    It appears that OMWB is dropping the NOT NULL condition for columns defined as IDENTITY in SQL server 7.
    SQL code to create table:
    CREATE TABLE [dbo].[PCPrsnCorp] (
    [PrsnCorpId] [int] IDENTITY (1, 1) NOT NULL ,
    [PrsnCorpTpEnum] [tinyint] NOT NULL ,
    [Name] [varchar] (128) NOT NULL ,
    [NameFirstIdx] [smallint] NULL ,
    [NameMidIdx] [smallint] NULL ,
    [NameLastIdx] [smallint] NULL ,
    [NameSuffixIdx] [smallint] NULL ,
    [NameLine2Idx] [smallint] NULL ,
    [CmpyId] [smallint] NULL ,
    [ClsnId] [int] NOT NULL
    ) ON [PRIMARY]
    GO
    OMWB migration script:
    REM
    REM Message : Created Table :sa.PCPRSNCORP
    REM User : system
    CREATE TABLE sa.PCPRSNCORP(PRSNCORPID NUMBER (10,0) ,PRSNCORPTPENUM NUMBER
    (3,0) NOT NULL,NAME VARCHAR2 (128) NOT NULL,NAMEFIRSTIDX NUMBER (5,0)
    ,NAMEMIDIDX NUMBER (5,0) ,NAMELASTIDX NUMBER (5,0) ,NAMESUFFIXIDX NUMBER
    (5,0) ,NAMELINE2IDX NUMBER (5,0) ,CMPYID NUMBER (5,0) ,CLSNID NUMBER
    (10,0) NOT NULL) TABLESPACE ORACLEFULL
    NOT NULL appears to be handled correctly if colummn is not defined as IDENTITY. Is there a patch, workaround, or OMWB option to get past this?

    Currently, the Migration Workbench converts IDENTITY columns into a BEFORE INSERT trigger and an Oracle sequence.
    This trigger will fire prior to any INSERT statement executing against the table. The trigger inserts the next value of the defined sequence into the converted IDENTITY column.
    The NOT NULL column attribute is therefore no longer needed.
    Strictly speaking, it would do no harm to keep the NOT NULL column attribute and so I will log a bug on your behalf.
    Thanks for the info.
    Brian.

  • How to create a single 'not null ' validation for all the items in a page ?

    Hi everyone ,
    how to create a single 'not null ' validation for all the items in a page ? I have many textfields . Instead of creating 'not null' validation for each item , I would like to create a a single validation control that will serve the purpose
    Thanks & Regards
    Umer

    Nice1 wrote:
    bob , as u said I have done the following :
    1) under create button , there are 9 items and for each item I have set Required to 'Yes'
    2) under delete button , there is 1 item and have set Required to 'Yes' for the item
    3) defined page validation for 9 items under 'create ' button and have set it to fire when 'create ' button clicked
    4) defined page validation for 1 item under 'delete ' button and have set it to fire when 'delete ' button clicked
    now , when I click 'create' button it even shows for the item under 'Delete ' button that it is a required itemSorry, I didn't see this note. The required template won't work, there is no way to attach it to the button.
    The best solution is as the reply a couple replies up
    Create 2 page type validations as a PL/SQL with code
    1st validation
    :P1_ITEM1 IS NOT NULL and :P1_ITEM2 IS NOT NULL ...... and :P1_ITEM9 IS NOT NULL  include all 9 items
    Set the When Button Pressed to the CREATE button
    2nd validation
    :P1_ITEM10 IS NOT NULL
    Set the When Button Pressed to the DELETE buttonI think that's going to be the easiest way to do it.
    Edited by: Bob37 on Apr 27, 2012 12:02 PM

  • Counting number of non NULL values in a list

    Given a list of 5 columns, how can I find out how many are not null?
    Eg.
    select '&Parm1','&Parm2','&Parm3','&Parm4','&Parm5', number_of_values_not_null('&Parm1','&Parm2','&Parm3','&Parm4','&Parm5')
    from Table
    where Criteria
    would give me:
    Parm1: A
    Parm2: B
    Parm3:
    Parm4:
    Parm5:
    A, B, , , , 2
    Thanks

    NVL2 might be slightly shorter, TABLE () might be slightly more intuitive. Probably six of one...
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> SELECT NVL2 ('A', 1, 0) +
      2         NVL2 ('B', 1, 0) +
      3         NVL2 (NULL, 1, 0) +
      4         NVL2 (NULL, 1, 0) +
      5         NVL2 (NULL, 1, 0) result
      6  FROM   DUAL;
        RESULT
             2
    SQL> CREATE OR REPLACE TYPE varchar2_table AS TABLE OF VARCHAR2 (4000);
      2  /
    Type created.
    SQL> SELECT COUNT (*)
      2  FROM   TABLE (varchar2_table ('A', 'B', NULL, NULL, NULL))
      3  WHERE  column_value IS NOT NULL;
      COUNT(*)
             2
    SQL>

  • Need to change the column constrain from NOT NULL to NULL

    Hi,
    My requriment is I have to change the column constraint (NOT NULL) to NULLable (column having data), I used below query for that
    alter table table_name modify transaction_cost2 default null
    even command is successfull, but column constrain is still NOT NULL.
    can you any one help on this.. ( steps to change column constain from not null to null)
    Thanks,

    ALTER TABLE table_name
      MODIFY( transaction_cost2 NUMBER NULL )That assumes that the data type of the TRANSACTION_COST2 column is NUMBER-- you'll want to use the current data type if it is something else. I'm hoping that the fact that you have a column named TRANSACTION_COST2 doesn't imply that you have an incorrectly normalized data model. But the name of the column certainly implies that you do.
    Justin

  • Need help, I have an error message "not enough storage"  for icloud and it will not let me do anything

    Need help... getting an error message "not enough storage" for icloud and it will not let me get passed the message

    See if this helps.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • DVWP XSLT count number of column having Yes/No values for each row

    I have a Data View Web Part .Now I have a column that contains either 'Yes' or 'No'
    and i want to count the number of 'Yes' for the rows and column  .
    below image will help to understand better what i am tying to achieve.  

    Here is XSLT code , you may find this usefull
    Row View Template :
    <xsl:template name="dvt_1.rowview">
          <xsl:param name="Rows"/>
          <xsl:variable name="CountYesForAll" select="number((. = contains(@Richard,'Yes')))
           +number((. = contains(@AndrewP,'Yes')))
           +number((. = contains(@Damien,'Yes')))
           +number((. = contains(@AndrewC,'Yes')))
           +number((. = contains(@Tiffany,'Yes')))
           +number((. = contains(@David,'Yes')))
           +number((. = contains(@Tony,'Yes')))
           +number((. = contains(@Saj,'Yes')))
           +number((. = contains(@Miguel,'Yes')))
           +number((. = contains(@Viv,'Yes')))
           +number((. = contains(@Paula,'Yes')))
           +number((. = contains(@Helen,'Yes')))
           +number((. = contains(@Matthew,'Yes')))"/>
          <xsl:variable name="RichardsCount" select="count($Rows[(@Richard)='Yes'])"></xsl:variable>
          <xsl:variable name="AndrewPsCount" select="count($Rows[(@AndrewP)='Yes'])"></xsl:variable>
          <xsl:variable name="DamiensCount" select="count($Rows[(@Damien)='Yes'])"></xsl:variable>
          <xsl:variable name="AndrewCsCount" select="count($Rows[(@AndrewC)='Yes'])"></xsl:variable>
          <xsl:variable name="TiffanysCount" select="count($Rows[(@Tiffany)='Yes'])"></xsl:variable>
          <xsl:variable name="DavidsCount" select="count($Rows[(@David)='Yes'])"></xsl:variable>
          <xsl:variable name="TonysCount" select="count($Rows[(@Tony)='Yes'])"></xsl:variable>
          <xsl:variable name="SajsCount" select="count($Rows[(@Saj)='Yes'])"></xsl:variable>
          <xsl:variable name="MiguelsCount" select="count($Rows[(@Miguel)='Yes'])"></xsl:variable>
          <xsl:variable name="VivsCount" select="count($Rows[(@Viv)='Yes'])"></xsl:variable>
          <xsl:variable name="PaulasCount" select="count($Rows[(@Paula)='Yes'])"></xsl:variable>
          <xsl:variable name="HelensCount" select="count($Rows[(@Helen)='Yes'])"></xsl:variable>
          <xsl:variable name="MatthewsCount" select="count($Rows[(@Matthew)='Yes'])"></xsl:variable>
      <tr>
       <xsl:if test="position() mod 2 = 1">
        <xsl:attribute name="class">ms-alternating</xsl:attribute>
       </xsl:if>
       <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
        <td class="ms-vb" width="1%" nowrap="nowrap">
         <span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="view"></span>
        </td>
       </xsl:if>
       <td class="ms-vb">
        <xsl:value-of select="@Title"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Richard) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Richard"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@AndrewP) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@AndrewP"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Damien) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Damien"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@AndrewC) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@AndrewC"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Tiffany) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Tiffany"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@David) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@David"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Tony) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Tony"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Saj) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Saj"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Miguel) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Miguel"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Viv) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Viv"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Paula) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Paula"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Helen) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Helen"/>
       </td>
       <td class="ms-vb">
        <xsl:attribute name="style">
         <xsl:if test="normalize-space(@Matthew) = 'NA'">background-color: #000000;</xsl:if>
        </xsl:attribute>
        <xsl:value-of select="@Matthew"/>
       </td>
       <td>
       <xsl:value-of select="$CountYesForAll"/>
       </td>
       <td>
        <xsl:if test="normalize-space(@Title) = 'Richard'">
         <xsl:value-of select="$CountYesForAll + $RichardsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Andrew P'">
         <xsl:value-of select="$CountYesForAll + $AndrewPsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Damien'">
         <xsl:value-of select="$CountYesForAll + $DamiensCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Andrew C'">
         <xsl:value-of select="$CountYesForAll + $AndrewCsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Tiffany'">
         <xsl:value-of select="$CountYesForAll + $TiffanysCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'David'">
         <xsl:value-of select="$CountYesForAll + $DavidsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Tony'">
         <xsl:value-of select="$CountYesForAll + $TonysCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Saj'">
         <xsl:value-of select="$CountYesForAll + $SajsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Miguel'">
         <xsl:value-of select="$CountYesForAll + $MiguelsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Viv'">
         <xsl:value-of select="$CountYesForAll + $VivsCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Paula'">
         <xsl:value-of select="$CountYesForAll + $PaulasCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Helen'">
         <xsl:value-of select="$CountYesForAll + $HelensCount"/>
        </xsl:if>
        <xsl:if test="normalize-space(@Title) = 'Matthew'">
         <xsl:value-of select="$CountYesForAll + $MatthewsCount"/>
        </xsl:if>
       </td>
      </tr>
     </xsl:template>
    Footer template to show sub total :
    <xsl:template name="dvt_1.footer">
      <xsl:param name="Rows" />
      <div class="bupareport">    
        <table border="0" width="100%" cellpadding="2" cellspacing="0">
       <tr>
        <td width="8%">Sub Total :</td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Richard)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@AndrewP)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Damien)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@AndrewC)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Tiffany)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@David)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Tony)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Saj)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Miguel)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Viv)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Paula)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Helen)='Yes'])" /></td>
        <td width="6%"> <xsl:value-of select="count($Rows[(@Matthew)='Yes'])" /></td>
        <td width="6%"> </td>
        <td width="8%"> <xsl:value-of select="@AndrewP"> </xsl:value-of></td>
       </tr>
      </table>
      </div>
     </xsl:template>

  • Count of non-empty rows of a table

    How to I get the number of non-empty rows of a table ?
    Thanks

    You can loops through the rows and check whether any cell is empty or not? Use a counter variable to increment the same.
    Thanks,
    Bibhu

  • Need to count the number of times the Basic Finish data chages

    HI Expertes,
    I have a requirement I need to count number of times the Basic finish date chaged for PM work order. I went throug our forums I got some info like using a standard function module
    CHANGEDOCUMENT_READ_HDRS_ONLY
    CHANGEDOCUMENT_READ_HEADERS
    CHANGEDOCUMENT_READ_POSITIONS
    But all the above function module will not be suitable for my requirement since  CHANGEDOCUMENT_READ_HDRS_ONLY it gives whole changes but my requirement is just need number of changes occurred in Basic Finish date but CHANGEDOCUMENT_READ_POSITIONS can give the filed number which has been changed but still I need change id.
    So kindly suggest me wether there is any other Standard FM to get number of changes occurred in Basic Finish date?
    Thanks,
    Rajesh

    Hi Debbie,
         To count the number of groups please try the folling steps:
    1) Create a formula @reset and place this formula in the page header
        whileprintingrecords;
        numbervar i:=0;
    2) Create another formula @evalgroup place this in the group header where you want to count the values.
        whileprintingrecords;
        numbervar i:= i+1;
    3) Create another formula @display and place this in report footer.
        whileprintingrecords;
        numbervar i;
    In order to display the count of details which are printing in the detail section place the eval formula in the detail section and the @display formula in the group footer.
    Hope this helps!!!
    Regards,
    Vinay

  • My iPhone 5s will not power on and I need my serial number for support.

    I am attempting to get help through Apple Support- Chat, but I need my serial number.  It is not showing up in iTunes under the device preferences.  Any other ways to retrieve the serial number through iCloud?
    If anyone has any idea of what is going on with my phone, I would love some assistance.  I live 45 minutes from the nearest Apple Store.  Here's the situation:
    About 2 weeks ago, my phone started shutting itself off and restarting randomly.
    About a week and a half ago, I would randomly get a blue screen and then the phone would restart multiple times.
    About a week ago I turned off Touch ID in an effort to resolve the issue, after reading some fixes from this community.  That seemed to help.  I do have the animation turned off, so I had read that there may be an issue between the Touch ID and animation reduction.  If that had not helped, I was going to turn the animation back on.
    Last night my phone seemed fine.  I did hear it restart in the middle of the night once, but this morning it will not power on at all.
    I tried connecting it to my computer through iTunes, but iTunes does not see it and I cannot access the device information from it.
    My phone is less than a month old, and for the first two weeks it worked great.  I am taking it into the AT&T Store today where it was purchased, but I don't really have high hopes for a resolution.
    Any help is much appreciated!

    Sorry AT&T store won't be much help.
    I suggest you make an appointment with the Genius bar and then go to the Apple store.

  • Need help to count number of rows and display in file

    Hello,
    my scenario is IDOC to File......i am using XSLT mapping and using FCC parameters to convert the flat file.
    now new requirement is i need to count number of rows and add count value last of the file.
    Please let me know how to do it,
    thanks in advance for your help.
    Regards,
    Chinna

    thanks again, one more Q.
    in XSLT mapping i have written for loop for complete structure.
    example : <Details>
                         <node1>
                         <node2>
                   </details>
    in XSLT mapping
                         <xsl:for-each select="ZMATMAS_01/IDOC/E1MARAM">
         <Details>
         </Details>
         </xsl:for-each>
    if i add the field at target side....then i will come under details node and it will be repeated.
    how to declare in XSLT mapping.

  • Counting number of occurances

    I have an array of queues,
    eg:
    1, 2 ,3
    4, 5 , 6
    1, 8, 9
    2, 4, 5
    so everytime i poll each queue I get the value of the first column. I need to count the occurances of each value. Eg for this example, 1 appear twice, 4 appear once and 2 appear once. How can I do this efficiently since I may have to fetch up to 1000 queue records?
    Thanks.

    Don't ask for much do ya!
    private int occurances[9];
    //the above array holds a value for each number up to the
    //maximum number we are looking for (presumed to be 9).
    //the array will hold an int representing how many times each
    //value has been found in a queue.
    constructor { //rename this so it is a proper constructor.
        for (int i = 0; i < occurances.length; i++) {
             occurances[i] = 0; //initialise all values of the array to zero.
    public void analyseQueue(ArrayList queue[])
        for (int i = 0; i < queue.length; i++) { //for each queue:
            ArrayList currentQ = queue; //extract the queue
    for (int n = 0; n < currentQ.size(); n++) { //for each element in the queue:
    int n = (int) currentQ.get(n); //extract the integer value of the element.
    occurances[n - 1]++; //as this number has been found, increase the
    //number of occurances of it. Note the -1 as an array is zero indexed.
    public int getOccurances(int n) {
    return occurances[n - 1]; //again, because zero indexed.

Maybe you are looking for