Sorting all records in datagrid

Hi All,
I have a datagrid with pagination. On default or on click of the sort arrow of a particular column in the grid  it sorts only the current page data. my requirement is it should sort across all records returned in array collection not only the records for the current page. Please share the working sample code.
Thanks,
Ravisha

Try this code:
<?xml version="1.0"?>
<!-- dpcontrols/adg/SimpleHierarchicalADG.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" layout="vertical">
  <mx:Script>
    <![CDATA[
        import mx.events.DataGridEvent;
          import mx.collections.ArrayCollection;
          include "dgData.as";
          [Bindable]
          private var dp:ArrayCollection;
          private var offset:int = 0;
          [Bindable]
          private var pageNum:int = 0;
          [Bindable]
          private var maxPages:int;
          [Bindable]
          private var dgRowCount:int = 9;
          private function init():void
              dp = new ArrayCollection();
              maxPages = dpHierarchy.length / dgRowCount;
              filterPage();
          private function navToPage(pageOffset:int):void
              pageNum += pageOffset;
              if (pageNum < 0)
                  pageNum = 0;
              if (pageNum > maxPages)
                  pageNum = maxPages;
              offset = pageNum * dgRowCount;
              filterPage();
          private function filterPage():void
              dp.source = dpHierarchy.source.filter(function callback(item:*, index:int, array:Array):Boolean
                          return (index >= offset && index < offset + dgRowCount);
          private function doSort(evt:DataGridEvent):void
              var sortDescending:Boolean = evt.itemRenderer.data.sortDescending;
              !sortDescending ? dpHierarchy.source.sortOn(evt.dataField, Array.NUMERIC | Array.DESCENDING) : dpHierarchy.source.sortOn(evt.dataField, Array.NUMERIC);
              filterPage();
      ]]>
    </mx:Script>
    <mx:DataGrid dataProvider="{dp}" rowCount="{dgRowCount}" sortableColumns="true" headerRelease="doSort(event)">
        <mx:columns>
            <mx:DataGridColumn headerText="ID" dataField="id"/>
            <mx:DataGridColumn headerText="First prop" dataField="firstProp"/>
            <mx:DataGridColumn headerText="Second prop" dataField="secondProp"/>
        </mx:columns>
    </mx:DataGrid>
    <mx:HBox horizontalAlign="center">
        <mx:Button label="Prev page" click="navToPage(-1)"/>
        <mx:Label text="{pageNum + 1}/{maxPages + 1}" textAlign="center" width="60"/>
        <mx:Button label="Next page" click="navToPage(1)"/>
    </mx:HBox> 
</mx:Application>
You have to add the following file to your source folder:
Hope you can work it out with this
Dany

Similar Messages

  • Sort all records except one

    I have a mysql table with three attributes.
    att1 | att2 | att3
    1 | 0.1 | 0.2
    2 | 0.4 | 0.3
    3 | 0.2 | 0.1
    4 | 0.3 | 0.5
    Now through my program, I select one record according to attribute 2. Suppose in this case I select the value 0.2(from att2) and get the index. Now what I want to do is: sort descending(here is want to exclude index 3 since it has already been identified by the first part of the program) according to the rest values in att3. I want the corresponding index of of these values too.
    Can anyone help plz.... I have tried to make the problem clear...In case of doubt please ask me..
    Thanks in advance
    Rakesh

    hai,
    be too specific. dont think that ur ques has to be short. type more about ur question and make us clear to clear ur doubt. please type how the record will be before ur program get executed and how the answer has to be after ur program has to be executed. that is show them as u showed the records before.
    by
    bvrk.

  • Sort all the Records in Data manager based on Update Date

    How to sort the reocrds in Data Manager based on Date or something ?
    And also I have three records for a same customer in ( for three different company codes ) and when I search for this customer with the Customer number then it is showing three records , but when I search with Update Date then no records are fetched ...what is the reason ?

    If you make a field as type "Time Stamp" in your data model using the MDM Console, make sure that the option Sort Index is set to Normal.  If this is the case, whenever a record is updated in the repository, the date will be updated.  If the sort index is normal, then MDM will allow you to sort the records based on the date and time by which they were updated.  You can do this by finding your time stamp field in the MDM data manager and clicking on it.  If there is an up and down arrow next to the name of your field, it means it can be sorted.  Also, to answer your other question, you can definitely search based on date.  Use the Free-Form Search on the left hand side of the data manager at the bottom of the screen.  Simply select a date, and it will show you all the records updated on that date.

  • End routine not updating all records

    Hi,
    I have an end routine to update a cube from another cube.
    The routine has two loops, one child loop inside the main loop. Result Package was sorted before the loops.
    Now, not all records were updated in the target infocube as per expectation. Also, when I pick one such record (that did not get updated) and debug, interestingly it shows that expected value has been assigned to the relevant field. And if I upload only that specific record to the cube, the record does get updated with expected value.
    The problem seem to appear only when the whole set of data is loaded.
    Any suggestion about the coding or further debugging will be greatly appreciated.
    Thanks,
    Pranab

    HI,
    check if u r using any internal tables, make this itab refresh at correct point.i tmight be sumtimes create problem.
    else paste ur code here...
    thnks.

  • Incomplete Data on report (report does not show all records from the table)

    Hello,
    I have problem with CR XI, I'm running the same report on the same data with simple select all records from the table (no sorting, no grouping, no filters)
    Sometimes report shows me all records sometimes not. Mostly not all records on the report. When report incomplete sometimes it shows different number of records.
    I'm using CR XI runtime on Windows Server 2003
    Any help appreciated
    Thanks!

    Sorry Alexander. I missed the last line where you clearly say it is runtime.
    A few more questions:
    - Which CR SDK are you using? The Report Designer Component or the CR assemblies for .NET?
    - What is the exact version of CR you are using (from help | about)
    - What CR Service Pack are you on?
    And a troubleshooting suggestion:
    Since this works on some machines, it will be a good idea to compare all the runtime (both CR and non CR) being loaded on a working and non working machines.
    Download the modules utility from here:
    https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip
    and follow the steps as described in this thread:
    https://forums.sdn.sap.com/click.jspa?searchID=18424085&messageID=6186767
    The download also includes instructions on how to use modules.
    Ludek

  • All Records not showing in Report

    Hi All,
    U just solved my amount problem....
    But now i gives my earlier problem again, means displaying only 1 rows, when i executing for 1 month in selection criteria...and amount showing right total of all records...
    example---
    Document No......Doc. date.......P.date........Vendor..........Name.........Tax Code.........Base Amt....... Tax Amt........Ven. Ref.........P. Doc...
    5500000022 .......22.04.2008 ...28.04.2008....1011............XXXXXXX........NB..................500,000............25,000.............A-102.......4500034463
    This Document No. is my 1st Document no. (5500000022)..
    Here Base Amount (500,000) & Tax Amount (25,000) is the total of more than 100 records total but showing in Single Row...(This rows showing the only 1st record)...
    Here what is the problem in my program...where i m wrong in clearing the itab or itab2...
    please let me know...
    I m again sending my corrected Program...
    Code-----
    REPORT  zak_form_c4 NO STANDARD PAGE HEADING LINE-SIZE 125  .
    TABLES : bsik,bkpf,bseg,j_1imovend,lfa1,t001,t005u,bsak,ekko,bsis, ekkn, anla, anlc.
    TYPE-POOLS : slis.
    DATA : BEGIN OF itab OCCURS 0,
           hkont LIKE bseg-hkont, "Gl account
           mwskz LIKE bseg-mwskz, "Tax Code
           dmbtr LIKE bseg-dmbtr, "Amount
           buzei LIKE bseg-buzei, "line item
           ebeln LIKE bseg-ebeln, "Purchasing Document
           ebelp LIKE bseg-ebelp, "line item nbr
           hwbas LIKE bseg-hwbas, "Base amount
           shkzg LIKE bseg-shkzg, "Debit/Credit code
           belnr LIKE bsik-belnr, "Document number
           gjahr LIKE bsik-gjahr, "Fiscal Year
           bldat LIKE bsik-bldat, "Document Date
           budat LIKE bsik-budat, "Posting Date
           lifnr LIKE bsik-lifnr, "Vendor number
           xblnr LIKE mkpf-xblnr, "Ven invoice nbr
           name1(25),                                           "name1
           ort01 LIKE lfa1-ort01,   "City
           j_1ilstno LIKE j_1imovend-j_1ilstno,  " Vendor tin nbr
           regio LIKE lfa1-regio, "Region Code
           bezei LIKE t005u-bezei, "Region desc
           dmbtr1 LIKE bseg-dmbtr, "Amount
           hwbas1 LIKE bseg-hwbas, "Base amount
    END OF itab.
    DATA : BEGIN OF itab3 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA:END OF itab3.
    DATA : wa LIKE LINE OF itab.
    DATA : BEGIN OF itab1 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA:END OF itab1.
    DATA : BEGIN OF itab2 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA:END OF itab2.
    ***********************************Purchase order history
    DATA:   BEGIN OF bet OCCURS 50.
            INCLUDE STRUCTURE ekbe.
    DATA:   END OF bet.
    DATA:   BEGIN OF bzt OCCURS 50.
            INCLUDE STRUCTURE ekbz.
    DATA:   END OF bzt.
    DATA:   BEGIN OF betz OCCURS 50.
            INCLUDE STRUCTURE ekbez.
    DATA:   END OF betz.
    DATA:   BEGIN OF bets OCCURS 50.
            INCLUDE STRUCTURE ekbes.
    DATA:   END OF bets.
    DATA:   BEGIN OF xekbnk OCCURS 10.
            INCLUDE STRUCTURE ekbnk.
    DATA:   END OF xekbnk.
    DATA : w_container TYPE scrfname VALUE 'CL_GRID',
           w_cprog TYPE lvc_s_layo,
           g_repid LIKE sy-repid,
           w_save TYPE c,
           w_exit TYPE c,
           cl_grid TYPE REF TO cl_gui_alv_grid,
           cl_custom_container TYPE REF TO cl_gui_custom_container,
           it_fld_catalog TYPE slis_t_fieldcat_alv,
           wa_fld_catalog TYPE slis_t_fieldcat_alv WITH HEADER LINE ,
           layout TYPE slis_layout_alv,
           col_pos  LIKE sy-cucol ,
           alvfc TYPE slis_t_fieldcat_alv.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS       :  hkont LIKE bseg-hkont OBLIGATORY. "GL Code
    *SELECT-OPTIONS   : hkont FOR bseg-hkont .
    SELECT-OPTIONS   : belnr FOR bsik-belnr .
    SELECT-OPTIONS   : gjahr FOR bsik-gjahr .
    SELECT-OPTIONS   : bldat FOR bsik-bldat.
    SELECT-OPTIONS   : budat FOR bsik-budat.
    SELECTION-SCREEN : END OF BLOCK b1.
    PERFORM fill_catalog1 USING:
    'HKONT'    'ITAB2'    'G/L Code' ,
    'BELNR'    'ITAB2'    'Document Number',
    'GJAHR'    'ITAB2'    'Year',
    'BLDAT'    'ITAB2'    'Doc. date' ,
    'BUDAT'    'ITAB2'    'Posting Date',
    'LIFNR'    'ITAB2'    'Vendor',
    'NAME1'    'ITAB2'    'Name',
    'EBELN'    'ITAB2'    'Purchasing Document',
    'MWSKZ'    'ITAB2'    'Tax Code',
    'HWBAS'    'ITAB2'    'Base Amount',
    'DMBTR'    'ITAB2'    'Tax Amount',
    'XBLNR'    'ITAB2'    'Vendor Inv. No.'.
    SELECT DISTINCT hkont belnr gjahr bldat budat INTO CORRESPONDING FIELDS OF TABLE itab
                      FROM bsis
                      WHERE bukrs = '1000'
                      AND hkont = hkont
                      AND belnr IN belnr
                      AND gjahr IN gjahr
                      AND bldat IN bldat
                      AND budat IN budat.
    SORT itab BY belnr.
    LOOP AT itab.
      SELECT * FROM bseg WHERE belnr = itab-belnr  AND gjahr = itab-gjahr
                                                   AND bukrs = '1000'
                                                   AND ( ebeln <> ' ' OR hkont = hkont ).
        IF sy-subrc = 0.
          itab-buzei = bseg-buzei.
          itab-mwskz = bseg-mwskz.
          IF bseg-ebeln <> ' '.
            itab-ebeln = bseg-ebeln.
            itab-ebelp = bseg-ebelp.
            MODIFY itab.
          ENDIF.
          IF bseg-hkont = hkont.
            itab-shkzg = bseg-shkzg.
            itab-hwbas = bseg-hwbas.
            itab-dmbtr = bseg-dmbtr.
            IF itab-shkzg = 'H'.
              itab-dmbtr = itab-dmbtr * ( -1 ).
            ENDIF.
            MOVE-CORRESPONDING itab TO itab2.
            APPEND itab2.
          ENDIF.
        ENDIF.
      ENDSELECT.
    ENDLOOP.
    LOOP AT itab2.
      SELECT SINGLE * FROM ekko WHERE ebeln = itab2-ebeln.
      IF sy-subrc = 0.
        itab2-lifnr = ekko-lifnr.
      ENDIF.
      CALL FUNCTION 'ME_READ_HISTORY'
        EXPORTING
          ebeln  = itab2-ebeln
          ebelp  = itab2-ebelp
          webre  = 'X'
        TABLES
          xekbe  = bet
          xekbz  = bzt
          xekbes = bets
          xekbez = betz
          xekbnk = xekbnk.
      itab2-xblnr = bet-xblnr.
      SELECT SINGLE * FROM lfa1 WHERE lifnr = itab2-lifnr.
      itab2-name1 = lfa1-name1.
      itab2-ort01 = lfa1-ort01.
      itab2-regio = lfa1-regio.
      SELECT SINGLE * FROM t005u WHERE bland = itab2-regio
                                  AND spras = 'EN'
                                  AND land1 = 'IN'.
      itab2-bezei = t005u-bezei.
      SELECT SINGLE * FROM  j_1imovend WHERE lifnr = itab2-lifnr.
      IF sy-subrc = 0 .
        itab2-j_1ilstno = j_1imovend-j_1ilstno.  " Vendor tin nbr
      ENDIF.
      MODIFY itab2.
    ENDLOOP.
    SORT itab2 BY belnr.
    LOOP AT itab2.
      DATA : cnt TYPE i,
             cnt1 TYPE i.
      itab1-dmbtr1 = itab1-dmbtr1 + itab2-dmbtr.
      itab1-hwbas1 = itab1-hwbas1 + itab2-hwbas.
      AT END OF belnr.
        cnt = sy-tabix.
        cnt1 = cnt - 1.
        DO cnt1 TIMES.
          DELETE itab2.
        ENDDO.
        CLEAR itab2.
        itab2-dmbtr = itab1-dmbtr1.
        itab2-hwbas = itab1-hwbas1.
        MODIFY itab2 TRANSPORTING dmbtr hwbas .
      ENDAT.
    ENDLOOP.
    layout-zebra = 'X' .
    layout-colwidth_optimize(1) = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = 'ZAK_FORM_C4'
        is_layout          = layout
        it_fieldcat        = it_fld_catalog
        i_default          = 'X'
        i_save             = 'A'
      TABLES
        t_outtab           = itab2
      EXCEPTIONS
        program_error      = 1
        OTHERS             = 2.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *&      Form  FILL_CATALOG1
          text
         -->P_FIELDNAME  text
         -->P_REF_TABLE  text
         -->P_SCRTEXT    text
    FORM fill_catalog1  USING   p_fieldname TYPE any
                                p_ref_table TYPE any
                                p_scrtext   TYPE any.
      CLEAR : wa_fld_catalog.
      wa_fld_catalog-fieldname  = p_fieldname.
      wa_fld_catalog-tabname    = p_ref_table.
      wa_fld_catalog-seltext_s  = p_scrtext.
      wa_fld_catalog-seltext_m  = p_scrtext.
      wa_fld_catalog-seltext_l  = p_scrtext.
    wa_fld_catalog-datatype = 'CURR'.
      wa_fld_catalog-outputlen = 20.
      APPEND wa_fld_catalog TO it_fld_catalog.
    ENDFORM.                    " fill_catalog1.
    Plz let me know...
    Thanks

    Hello Prince,
    I just want that my code will show single time records..and Sum of base Value and Tax amount...
    You want to summarise Base Value and Tax amount per document, right
    I am making a very very small modification to the declaration of ITAB:
    DATA :
    BEGIN OF itab OCCURS 0,
    belnr LIKE bsik-belnr, "Document number "--> Add here
    buzei LIKE bseg-buzei, "line item "--> Add here
    hkont LIKE bseg-hkont, "Gl account
    mwskz LIKE bseg-mwskz, "Tax Code
    dmbtr LIKE bseg-dmbtr, "Amount
    " buzei LIKE bseg-buzei, "line item "--> Delete Here
    ebeln LIKE bseg-ebeln, "Purchasing Document
    ebelp LIKE bseg-ebelp, "line item nbr
    hwbas LIKE bseg-hwbas, "Base amount
    shkzg LIKE bseg-shkzg, "Debit/Credit code
    " belnr LIKE bsik-belnr, "Document number "--> Delete here
    gjahr LIKE bsik-gjahr, "Fiscal Year
    bldat LIKE bsik-bldat, "Document Date
    budat LIKE bsik-budat, "Posting Date
    lifnr LIKE bsik-lifnr, "Vendor number
    xblnr LIKE mkpf-xblnr, "Ven invoice nbr
    name1(25), "name1
    ort01 LIKE lfa1-ort01, "City
    j_1ilstno LIKE j_1imovend-j_1ilstno, " Vendor tin nbr
    regio LIKE lfa1-regio, "Region Code
    bezei LIKE t005u-bezei, "Region desc
    dmbtr1 LIKE bseg-dmbtr, "Amount
    hwbas1 LIKE bseg-hwbas, "Base amount
    END OF itab.
    And modified the code as below:
    DATA:
    V_DMBTR TYPE DMBTR,
    V_HWBAS TYPE HWBAS.
    LOOP AT ITAB2.
      V_DMBTR = V_DMBTR + ITAB2-DMBTR.
      V_HWBAS = V_HWBAS + ITAB2-HWBAS.
      AT END OF BELNR.
        ITAB2-DMBTR = V_DMBTR.
        ITAB2-HWBAS = V_HWBAS.
        APPEND ITAB2 TO ITAB3.
        CLEAR: ITAB2, V_DMBTR, V_HWBAS.
      ENDAT.
    ENDLOOP.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = 'ZAK_FORM_C4'
    is_layout = layout
    it_fieldcat = it_fld_catalog
    i_default = 'X'
    i_save = 'A'
    TABLES
    t_outtab = itab3 "itab2 --> Use ITAB3 instead of ITAB2
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    BR,
    Suhas
    Edited by: Suhas Saha on Jan 13, 2009 3:23 PM

  • How do I sort ALL my bookmarks into alphabetical order with ONE CLICK? (continued)

    You can sort all your bookmarks alphabetically in one shot with the Auto-Sort Bookmarks add-on.
    https://addons.mozilla.org/en-US/firefox/addon/auto-sort-bookmarks/?src=api
    Note: Since the other thread with this name was closed, I'm posting this in a new thread.
    Here's the old thread: https://support.mozilla.org/en-US/questions/933835

    I've been watching this (general) thread for years and waiting patiently for Mozilla to address it, w/out any success at all - obviously. And, no, the answers are NOT helpful to me!
    I understand many people have no interest in bookmarks but clearly lots of people still use them. If you're going to have the feature that purports to sort bookmarks, for pete's sake, make it work. I'd think it would be an embarrassment to have a part of your program malfunction for so long. I mean, what are you folks? IE!?! Why don't you just ask someone to spend a couple days addressing the issue and get it straightened out? (Clearly i care enough about it but I don't code, so… I'm useless.)
    For the record, a user shouldn't have to individually sort each folder within their Bookmarks folder. One should be able to pick an option that would apply to all folders. Sure, leave the ability to sort individually but add an "apply to all" feature to the mother folder. Then, find a way to have it automatically maintain that status, whatever is selected. Doesn't sound like that difficult a task, given all the other great things you guys and girls do all the time! That's my ¢.
    By the way, I'm using a MB Pro 4,1 (early 2008), OS 10.6.8, and Firefox 19.0 beta. Thanks for listening to my bitching.
    - cheers

  • Deleting all Records in a Table

    I have an table that is populated as users login and move through an application so I can tell what they are doing as well as who is logged in. Once and a while I would like to empty this table of all records once I have exported the audit data. I would like to do this from the same page that I have based a tabular form on. Can any suggest the easiest way to achieve this?
    Could the following SQL be used somewhere to do the job?
    delete CREATE_BY, CREATE_ON, ACTION, SUBJECT from AUDIT;
    Kind Regards,
    Steve

    Hi,
    Even with TRUNCATE (which is what I use to do this sort of thing), you have to bear in mind what happens to indexes on the table (and, I'm assuming that there will be sizable indexes involved) and the time it takes to clear these out on top of clearing out the table's data. From advice I've seen on the SQL forum, I do something like the following in PL/SQL to clear a table:
    BEGIN
    EXECUTE IMMEDIATE 'ALTER INDEX TABLENAME_IDX1 UNUSABLE';
    EXECUTE IMMEDIATE 'TRUNCATE TABLENAME';
    EXECUTE IMMEDIATE 'ALTER INDEX TABLENAME_IDX1 REBUILD NOLOGGING';
    COMMIT;
    END;Andy

  • Adding All Records In Report Parameter

    This is in addition to my previous post.
    I have this code as the source to a lov
    SELECT l.extkey||' - '||l.longdescr a, l.clocid b
    from udm_cloc l, udm_cust c, udm_lde lde
    where l.custid = c.custid
    and c.ldeid = lde.ldeid
    and lde.ldekey = :F140_LDEKEY
    and l.closedate is null
    and l.orddcid = :P9_DCID
    union
    select 'ALL Records' a, -1 b from dual
    ORDER by 2It is working fine except I need to change the ORDER BY clause to
    ORDER BY to_number(l.extkey) asc
    When I do that, I get an error
    LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
    Cheers
    Gus

    Gus C wrote:
    This is in addition to my previous post.
    I have this code as the source to a lov
    SELECT l.extkey||' - '||l.longdescr a, l.clocid b
    from udm_cloc l, udm_cust c, udm_lde lde
    where l.custid = c.custid
    and c.ldeid = lde.ldeid
    and lde.ldekey = :F140_LDEKEY
    and l.closedate is null
    and l.orddcid = :P9_DCID
    union
    select 'ALL Records' a, -1 b from dual
    ORDER by 2It is working fine except I need to change the ORDER BY clause to
    ORDER BY to_number(l.extkey) asc
    When I do that, I get an error
    LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.Create your query as an in-line view, including any additional columns required for sorting, and perform the sort and final LOV projection in the outer query:
    select
              lov_label
            , lov_value
    from
              (select
                        deptno || ' - ' || ename                lov_label
                      , empno                                   lov_value
                      , /* to_number here if required */ deptno lov_sort
              from
                        emp
              union all
              select
                        '- All -'
                      , null
                      , null
              from
                        dual)
    order by
              lov_sort nulls first

  • Problem in sorting the records

    Hi All,
    I have to sort some records based on a key. If the key field is optional then how to sort the records. For example consider the follwing records.
    <row>
          <name>jaya</name>
          <address>hyd</address>
          <material>d</material>
          <units>4</units>
          <price>6</price>
    </row>
      <row>
          <address>ss</address>
          <material>wd</material>
          <units>7</units>
          <price>9</price>
       </row>
    <row>
          <name>radha</name>
          <address>pune</address>
          <material>g</material>
          <units>9</units>
          <price>3</price>
    </row>
    Here name field is used as a key in sorting the records. in the second record name field does'nt exists. All the records that doesnt have the name field shud come on the top and the rest with name field shud come sorted.
    Can anyone please helpout how to solve this problem??

    Jhansi,
    Did u solved the issue? The scenario is lil bit complicated, please consider my below suggestion, if you haven't achieved your results.
    I must really thankful to Michal and all my SDN friends,who guided me to use the logic-using multiple Mapping program in one Interface mapping.
    /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
    Ok, let us come to the logic.
    For your problem we need to use two mapping programs.
    <b>Mapping Program 1</b>
    http://www.flickr.com/photo_zoom.gne?id=897495319&size=o
    <b>Mapping Program 2</b>
    http://www.flickr.com/photo_zoom.gne?id=897495327&size=o
    http://www.flickr.com/photo_zoom.gne?id=897495341&size=o
    <b>UDF1 - Testing</b>
    http://www.flickr.com/photo_zoom.gne?id=897495429&size=o
    String temp;
    for(int i=0;i<Name.length;i++)
    for(int j=i1;j<Name.length;j+)
    if(Name<b>[</b>i<b>]</b>.compareToIgnoreCase(Name[j])>0)
               temp = Name<b>[</b>i<b>]</b>;
                Name<b>[</b>i<b>]</b>= Name[j];
                Name[j]=temp;
    for(int i=0;i<Name.length;i++)
    if(Name<b>[</b>i<b>]</b>.equals("0"))
    result.addSuppress();
    result.addContextChange();
    else
    result.addValue(""Name<b>[</b>i<b>]</b>"");
    result.addContextChange();
    <b>UDF 2 - Testin1</b>
    http://www.flickr.com/photo_zoom.gne?id=897495437&size=o
    String temp,temp1;
    for(int i=0;i<Name.length;i++)
    for(int j=i1;j<Name.length;j+)
    if(Name<b>[</b>i<b>]</b>.compareToIgnoreCase(Name[j])>0)
               temp = Name<b>[</b>i<b>]</b>;
                Name<b>[</b>i<b>]</b>= Name[j];
                Name[j]=temp;
          temp = Values<b>[</b>i<b>]</b>;
                Values<b>[</b>i<b>]</b>= Values[j];
                Values[j]=temp;
    for(int i=0;i<Values.length;i++)
    result.addValue(""Values<b>[</b>i<b>]</b>"");
    result.addContextChange();
    <b>Interface Mapping</b>
    http://www.flickr.com/photo_zoom.gne?id=897495361&size=o
    <b>Finally -Results:</b>
    http://www.flickr.com/photo_zoom.gne?id=897498639&size=o (My Data)
    http://www.flickr.com/photo_zoom.gne?id=897498659&size=o (Your Data)
    I hope it helps you!!!!
    I don't know whether this is the correct way or any other simplest way to do so. Also I request our friends to feedback their inpute regarding this logic.
    Jhansi,if you have any doubts in achieving the same, kindly reply back.
    Best regards,
    raj.

  • Need Sorter java  file   for sorting the records in webdynpro java

    Hi  Gurus
       I  had urgent requirement please give your inputs
       In my webdynpro java i need to sort entire records in table
       I now we need One sorter java class please provide that java file
       please suggest the all the steps how  to do
    Thanks
    renu.

    1. Implement class comparator wich will compare records according your sort preferencies,
    like this:
         public class record_Comparator implements Comparator{
              public int compare(Object emp1, Object emp2){
          // here is your code for return -1if 'before'  or 0 if equal or 1if 'after'
                   int stepId_1 = ((record)emp1).get_someValue();       
                   int stepId_2 = ((record)emp2).get_someValue();
                   if(stepId_1 > stepId_2)
                        return 1;
                   else if(stepId_1 < stepId_2)
                        return -1;
                   else
                        return 0;   
    than call method sort() with your collection of records,
    like this:
    Collections.sort(record_collection, new record_Comparator());

  • Need to view all records with two variables in recordset

    Hi - My recordset has two variables used to sort products by popularity and type.  But I want a "View all" link that shows all records, in ascending order, regardless of popularity or type.  At the moment the .php page is set up to receive either the popularity (varPopular) variable or the product type variable (varGrouping).  If neither variable is provided, no products appear on screen.  How do I set up the recordset to allow for all records to be displayed?  Thanks for your help!
    [CODE]
    $varPopular_Recordset1 = "n";
    if (isset($_GET[popular])) {
      $varPopular_Recordset1 = $_GET[popular];
    $varGrouping_Recordset1 = "1";
    if (isset($_GET[grouping])) {
      $varGrouping_Recordset1 = $_GET[grouping];
    mysql_select_db($database_connGiavan, $connGiavan);
    $query_Recordset1 = sprintf("SELECT crystal_colors.cystalid, crystal_colors.displayname, crystal_colors.imagename, crystal_colors.popular, crystal_colors.`grouping` FROM crystal_colors WHERE crystal_colors.popular=%s OR crystal_colors.grouping=%s", GetSQLValueString($varPopular_Recordset1, "text"),GetSQLValueString($varGrouping_Recordset1, "int"));
    $Recordset1 = mysql_query($query_Recordset1, $connGiavan) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $varGrouping_Recordset1 = "$_GET[grouping]";
    if (isset($_GET[grouping])) {
      $varGrouping_Recordset1 = $_GET[grouping];
    $varPopular_Recordset1 = "$_GET[popular]";
    if (isset($_GET[popular])) {
      $varPopular_Recordset1 = $_GET[popular];
    mysql_select_db($database_connGiavan, $connGiavan);
    $query_Recordset1 = sprintf("SELECT crystal_colors.cystalid, crystal_colors.displayname, crystal_colors.imagename, crystal_colors.popular, crystal_colors.`grouping` FROM crystal_colors WHERE crystal_colors.popular=%s OR crystal_colors.grouping=%s", GetSQLValueString($varPopular_Recordset1, "text"),GetSQLValueString($varGrouping_Recordset1, "int"));
    $Recordset1 = mysql_query($query_Recordset1, $connGiavan) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    [Moved to Dreamweaver Application Development forum by moderator]

    To start with, you should be aware of the fact that you have the same recordset code twice in your page.
    You'll find an article that explains how to build a SQL query to do what you want here: http://cookbooks.adobe.com/post_Create_search_query_with_optional_fields-16245.html.

  • Sorting Database record results

    Hello,
    I have a cfm that outputs a table and populates it with
    records of the database. Using the following query:
    As you can see from the SQL, the query can read url
    parameters like such:
    "index.cfm?eng=MC&month=4&year=2007&destino=EXTRANJERO&submit=Submit+Query"
    and output the records that fit the criteria.
    Now my problem is everytime I try to sort by any of this
    headers
    <a href="index.cfm?sort=#IIF(sort is 19, '20',
    '19')#"> the server will forget allt he other search
    parameters within the url.
    How do I preserve the other url parameters before sorting?
    Also, if someone could plz point me in the direction of
    another site with a great CF community I would appreciate it.
    Thanks

    One option is to parse the CGI.QUERY_STRING (ie a string of
    all url variables) and grab all of the parameters except "sort".
    Then append those parameters to your header. Possibly something
    like this
    <cfset newQueryString = reReplaceNoCase(CGI.QUERY_STRING,
    "&*sort=[^&]*", "", "all")>
    <a href="index.cfm?sort=#IIF(sort is 19, '20',
    '19')#&#newQueryString#"> ..
    Btw, I would recommend using cfqueryparam. Its dangerous to
    use URL variables directly in a query.
    Update: Corrected typo in CGI variable name

  • How to show all records by default on search result page?

    Hi
    I am trying to make a search page that would execute the search in the database based on one or more field constraints.
    (Using MySQL,PHP)
    I have  2 columns in the database "vm_ip" (primary key) <IP address>, "Operating_System" <Any, Windows, Solaris, AIX>
    need to search vm_ip based on other two fields.
    PROBLEM: Need to show all the record when I select "Any" in the Operating_System  drop down menu.
    <p>Operating System:
        <select name="os_select" id="os_select">
        <?php
    $os_count=1;
    foreach($os_type as $value) //(os_type is array with possible values of OS)
    echo "<option value=".$os_count.">".$value."</option>";
        $os_count++;
    ?>
          <option value=" " selected="selected">Any</option>
        </select>
      </p>
    this code POSts  NULL value to the search page.
    Below code is of recordset on  search page
    $varOS_virtual = "Operating_System"; // recordset variable set to same as column name (default value)
    if (isset($_POST['os_select'])) //this should not be true
      $varOS_virtual = $_POST['os_select'];
    mysql_select_db($database_xyz_db, $xyz_db);
    $query_virtual = sprintf("SELECT table.VM_IP FROM table
    WHERE table.Operating_System=%s", GetSQLValueString($varOS_virtual, "int"));
    $virtual = mysql_query($query_virtual, $xyz_db) or die(mysql_error());
    $row_virtual = mysql_fetch_assoc($virtual);
    $totalRows_virtual = mysql_num_rows($virtual);
    I expected the 'os_select' field to be null and default value of Operating_System to be "Operating_System" so that the Query shows all records.
    But instead the value being passed in the Query is "0". and no records are shown.
    What can I do to show all records?
    As probably obvious I am new to php/MySQL so all the help is most welcomed .
    Thanks

    Hi
    Thanks for the prompt reply but this does not solve my problem.
    First thing I appologise for giving you incorrect info. Actually I have many more constraints on the search apart from OS.
    Didn't think I would get single constraint specific ans.
    Here is what all i tried and problems I faced:
    1. I cannot use seperate queries cause I have around 7-8 other constraints on the search.
    2. I cannot play around with the Record set code. For some reason even if I mess with it a little bit Dreamweaver stops recognising the recordset. for eg i tried the below code:
    $query_virtual = sprintf("SELECT table.VM_IP FROM table WHERE
    table.Operating_System=%s ,($_POST['os_select']=="")? TRUE:GetSQLValueString($varOS_virtual, "int"));
    this ran well for the first time, and then the record set was screwed up. kept on asking me to "Discover" the links, which it couldn't do.
    3.  take a look at this code:
    $varOS_virtual = "Operating_System";
    if (isset($_POST['os_select'])) {
      $varOS_virtual = $_POST['os_select'];
    $varState_virtual = "State";               //second constraint
    if (isset($_POST['state_select'])) {
      $varState_virtual = $_POST['state_select'];
    mysql_select_db($database_xyz, $xyz);
    $query_virtual = sprintf("SELECT table.VM_IP FROM table AND table.Operating_System=%s AND State=%s",
    GetSQLValueString($varOS_virtual, "int"),GetSQLValueString($varState_virtual, "int"));
    $virtual = mysql_query($query_virtual, $xyz) or die(mysql_error());
    $row_virtual = mysql_fetch_assoc($virtual);
    $totalRows_virtual = mysql_num_rows($virtual);
    here on passing NULL value for "Any"  GetSQLValueString($varOS_virtual, "int") functions returns NULL and though the Default value of
    varOS is set to 'Operating_System" query takes NULL value only which when executed shows no records.
    My problem majorly revolves around how to put something like "WHERE Operating_System= Operating_System" OR  "WHERE Operating_System= TRUE" in the query, when passed through variable they are sent as Strings or NULL.
    Thats why WHERE 1=1 also doesnt work, because it has "WHERE Operating_System= NULL" in AND.
    Logically when NULL is passed default value of variable should comeinto picture, but tha isnt happening.
    Thanks again for answering. hope I was able to explain my problem.

  • Display all records from 4 select list

    Hi,
    trying to associate 4 select list where i could display all records from a list linked to an other list.
    1./ Created an item for each select list
    P1_employee_name
    P1_departments
    P1_employee_type
    P1_locations
    2./Set both null and default values to '-1' for each item
    3./Associated these items to source columns in the Region:
    where employee_name=:P1_employee_name
    or :P1_employee_name ='-1'
    and departments=:P1_departments
    or :P1_departments ='-1'
    and ......
    When running the report, couldn't display all records from a given list associated to an other list.
    e.g: Display all emp and type of emp for sales dept in Paris.
    Thks for your help

    I believe the issue is that you need to group your predicates such as:
    where (employee_name=:P1_employee_name
    or :P1_employee_name ='-1')
    and
    (departments=:P1_departments
    or :P1_departments ='-1')
    Also, if you are not already using the "select list with submit" type items, these work great for this case as the page will be submitted when the user changes the value of employeenam and the report will then reflect this change.

Maybe you are looking for

  • How to reset my Admin Password?

    Hi, I bought a new Macbook Pro laptop yesterday running OS X Mavericks 10.9.1 and had it been set up in store so when I got home it was ready to use. Did not have to set up anything! Today I was trying to search for some videos on youtube and apparen

  • Multiple Sites, Multiple Domains, one .mac account?

    So, is this possible? Can you create multiple sites in iWeb, save them to a .mac account, and then purchase domain names for each of those sites and have one assigned to each? I'm assuming no, but I'm seeing if someone knows how or someone has some w

  • Error in RWB Component Monitoring ... "Domain ???"

    Hello Everyone! A problem suddenly popped up in our SLD. When I navigate to RWB > Component Monitoring... I can no longer click on the "Integration Server" The Domain shows <i>"Domain ???"</i> would anyone know what could be the problem? Warm regards

  • Hierarchical queries (mother, father,...)

    Hi guys, a have a problem that I think it can be solved whit hierarchical queries. the question is like this. I have a person ...and each person has a mother and a father. (the mother/father may be or not be in my table) so my table configuration wil

  • Opening an external .exe?

    Hi I have a button in my Air app that, when clicked, I want to open an .exe app (unrelated program that doesn't have to communicate with my air app). I found the following code on the Adobe site to get me started, but a) I'm not sure how to run it fr