Dynamic Sort/Break

I want to let the users Dynamically chose the sort order of a report. The report is like this:
select last_name, first_name, department, emp#
from emo
I have a field where the user can choose to sort by, last name, first_name department, emp#
Can I do something with the XSL sort to have it be dynamic based on a field value?
<?for-each:ROW?><?sort:p1_sort_field;?>

Thanks Tim. I still can't get it to work. It is giving me an error when I try to run the .RTF from my APEX page.
I created an item on my page name 'P507_ORDER_BY'. I set the value to 'GRADE_LEVEL'.
I added this to the help Text of my RTF:
<xsl:param name="order" select='''P507_ORDER_BY''' xdofo:ctx="begin"/> <?for-each:ROW?><?sort:./*[name(.)=$order]?>
Here is my XML:
<?xml version="1.0" encoding="UTF-8" ?>
- <DOCUMENT>
<DATE>14-APR-09</DATE>
<USER_NAME>BOBM</USER_NAME>
<APP_ID>20080618</APP_ID>
<APP_NAME>APEX - Application Builder</APP_NAME>
<TITLE>ID_LST</TITLE>
<P507_YEAR>1AD004DBEE904C32B6F6C0D7183BA735</P507_YEAR>
<P507_ORDER_BY>GRADE_LEVEL</P507_ORDER_BY>
- <REGION ID="0">
- <ROWSET>
- <ROW>
<STUDENT_ID>700</STUDENT_ID>
<STATE_STU_ID />
<STUDENT_NAME>Kopacko, Christopher</STUDENT_NAME>
<GRADE_LEVEL>09</GRADE_LEVEL>
<SEX>M</SEX>
<ETHNIC>04</ETHNIC>
<SOC_SEC_NO />
<BIRTH_DATE>02-FEB-98</BIRTH_DATE>
<SCHOOL>ABC</SCHOOL>
</ROW>
-</ROWSET>
</REGION>
</DOCUMENT>
Any ideas?
Edited by: bobmagan on Apr 14, 2009 5:03 AM
Edited by: bobmagan on Apr 14, 2009 5:04 AM

Similar Messages

  • Dynamic Sorting on Multiple filed in Crystal report 2008

    Hi
      I am using Crystal report 2008 sp3 full build with hotfix 3.3 along with ASP.NET 2.0
      I have implimented the multi filed sorting using the record sort export and setting the sort order in the report designer.
    Now my requirement is such that i would like to have dynamic sorting on multiple fileds while report is displayed in the UI.
    Means suppose i have a report with Customer region,name,city,rating,status etc.
    Now by using the sort control  i would like to have the functionality in such a way that if user
    a)  first sorts on the region then the records should be first sorted by region
    b)  then sorts on the city then the records should be sorted first by region then by city
    c) now sorts on the  rating then the records should be sorted first by region ,second by city and then by rating
    Now other user may do
    a) first sorts on the rating then the records should be first sorted by rating
    b)  then sorts on the status then the records should be sorted first by rating then by status
    c) now user sorts on the  region then the records should be sorted first by rating,second by status and then by region
    and so on the sorting criteria changes from user to user through the UI.
    Is there any way to achieve the dynamic kind of sorting with Crytsal report 2008 where we can set the order of the fileds at sorting in UI dynamically .The sorting order of the fields are not known at the time of design of the report and its completely depends on the user's need.
    Please let me know if you require any information on the same.
    Regards,
    smitha

    Hello,
       Good Day!
       Thanks for your answer.
       Could you please explain me in detail how to achieve this functionality?
       Do i need to create a static parameter?
       I  get my data set through the command option in crystal report.So i think i need to go by formula in the report.
       i am just putting down the steps to follow.Please correct me if i am wrong.
      step1 :Create s static parameter with the name SORT.
    step2: create the formula as you have mentioned like     
        (IF {?Sort}='Vendor Number' THEN {Pr_Voucher_Status;1.Vendor_Key}& " "& {Pr_Voucher_Status;1.ap_remt_key}
        & " " & {@date}
       else
        IF {?Sort}='Invoice Number' THEN {Pr_Voucher_Status;1.ap_vchr_invno}& " " & {Pr_Voucher_Status;1.Vendor_Key}&
        " " &{@date}
       else
       IF {?Sort}='Invoice Amount' THEN {Pr_Voucher_Status;1.ap_vchr_amtc}& " " & {Pr_Voucher_Status;1.Vendor_Key}&
         " " &{@date})
        I could not  understand what this formula is really doing .
        Could you please tell me what the following names indicates? :
                  Pr_Voucher_Status :- Table/Command name ??
                  Vendor Number,Invoice Number etc.. :-  ??
                 Vendor_Key,ap_vchr_invno,ap_vchr_amtc .. :-  Filed names ??
                 use of 1.{} :- ??                              
    step3: place the below formula in the page header  to display the sort order
        (if {?SORT}='Vendor Number' then "Vendor Number, Remit To, Invoice Date"
              else if {?SORT}='Invoice Number' then "Invoice Number, Vendor Number, Invoice Date"
              else if {?SORT}='Invoice Amount' then "Invoice Amount, Vendor Number, Invoice Date") .
    Note:-My report does not have grouping.Do i need to have grouping?
    in this case how the sort control will work  ?
    As i have mentioned in the first post the order of sorting is completely depends on the user's perspective .
    The report is used by the whole organization ..
    i mean the people with different roles like Manger,Team leads,modul leads,developers ,testers etc..
    the usage of report varies according to the roles so the sort order also.
    Regards,
    smitha.
    Edited by: smitha thomas on Mar 16, 2011 5:01 AM

  • How to acheive Pagination and Dynamic sorting in Web layout.

    Hi All,
    I'm new to Oracle Reports. I use Report Builder 10.1.2.0.2.
    I tried creating a template for simple tabular report. I modified the tempalte for Paper layout, Web layout ie modified .tdf, html, css files.
    When the data is dispalyed in the web browser, i need to do Pagination and dynamic sorting (ie when the column heading is clicked, it needs to do sorting by that column).
    In the jsp page of the report, it is possible but i want to incorporate this functionality in the Template. So that a single template can be used across multiple reprots with out any modification.
    Can any one please tell me how to do this.
    Please reply me at the earliest. Its very urgent.
    Thanks & Regards,
    P. Gayathri Devi

    Igor,
    You'll need to switch from using Partial Page Rendering to full page submits on that report. In version 4.0 we should be getting more control over event handling in PPRs but to what extent is still unknown.
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen
    http://sourceforge.net/projects/plrecur

  • Dynamic sort in ALV

    hi all,
    HOw can we write the dynamic sort in ALV.
    regards,
    AJ

    Hi,
    Please find the sample code for dynamic sort in OO ALV
      perform built_sort_table.
    form built_sort_table.
      data ls_sort_wa type lvc_s_sort.
      ls_sort_wa-spos = 1.
      ls_sort_wa-fieldname = 'MATNR'.    "<< here your pass fieldname to sort dynamically
      ls_sort_wa-up = selected.
      ls_sort_wa-subtot = ''.
      append ls_sort_wa to gt_sort.
      ls_sort_wa-spos = 2.
      ls_sort_wa-fieldname = 'STATUS'.  "<< here your pass fieldname to sort dynamically
      ls_sort_wa-up = selected.
      ls_sort_wa-subtot = ''.
      append ls_sort_wa to gt_sort.
    endform.                               " BUILT_SORT_TABLE
        call method grid1->set_table_for_first_display
          exporting
            is_layout                     = gs_layout
            is_variant                    = gs_variant
            i_save                        = 'A'
            it_toolbar_excluding          = i_exclude[]
          changing
            it_outtab                     = i_output[]
            it_fieldcatalog               = i_fieldcat[]
            it_sort                       = gt_sort[]
          exceptions
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            others                        = 4.
    aRs

  • Dynamic sort help needed

    I am trying to implement a dynamic sort using pl/sql procedure
    with two IN params, which tell what column to sort by
    and wich direction. smth. like this
    procedure getEmployees (p_dept_no in employee.dept_no%type,
    p_sortBy in varchar2,
    p_sortDir in varchar2
    p_empl_cur in out emplCur
    ) is
    begin
    OPEN p_empl_cur
    FOR
    SELECT EMP_ID, F_NAME, L_NAME
    FROM EMPLOYEE
    WHERE DEPT_NO=p_dept_no
    ORDER BY p_sortBy p_sortDir ; --> this is the part that does not work
    -- I make sure that the params values are correct
    -- possible p_sortBy values: EMP_ID, F_NAME, L_NAME
    -- and p_sortDir: 'ASC' or 'DESC'
    end getEmployees;
    Thank you in advance.

    Try execute immediate.
    Some thing like this:
    PROCEDURE GETEMPLOYEES (P_DEPT_NO IN EMPLOYEE.DEPT_NO%TYPE,
    P_SORTBY IN VARCHAR2,
    P_SORTDIR IN VARCHAR2
    P_EMPL_CUR IN OUT EMPLCUR
    ) IS
    BEGIN
    OPEN P_EMPL_CUR
    FOR
    SORT_SQL := NULL;
    SORT_SQL := 'SELECT EMP_ID, F_NAME, L_NAME FROM EMPLOYEE'||
    ' WHERE DEPT_NO=P_DEPT_NO '||
    ' ORDER BY '||P_SORTBY||' '||P_SORTDIR||';'
    EXECUTE IMMEDIATE SORT_SQL INTO P_EMPL_CUR;
    Thanks
    Vasu
    I am trying to implement a dynamic sort using pl/sql procedure
    with two IN params, which tell what column to sort by
    and wich direction. smth. like this
    procedure getEmployees (p_dept_no in employee.dept_no%type,
    p_sortBy in varchar2,
    p_sortDir in varchar2
    p_empl_cur in out emplCur
    ) is
    begin
    OPEN p_empl_cur
    FOR
    SELECT EMP_ID, F_NAME, L_NAME
    FROM EMPLOYEE
    WHERE DEPT_NO=p_dept_no
    ORDER BY p_sortBy p_sortDir ; --> this is the part that does not work
    -- I make sure that the params values are correct
    -- possible p_sortBy values: EMP_ID, F_NAME, L_NAME
    -- and p_sortDir: 'ASC' or 'DESC'
    end getEmployees;
    Thank you in advance.

  • How to achieve dynamic page break in Smart form

    Hi
              1.How to achieve dynamic page breaks in Smart forms.
               2.What are the various table types in Smart forms.
    Regards

    <i>Dynamic page break : </i>
    create a node of type COMMAND and in its attributes check "Go to new page".
    <i>There are Tables and Templates in smart forms :</i>
    Use node type <i>Template</i> to display a table whose layout and size (number of lines and columns) is determined before the runtime of the print program else use <i>Table</i>.
    Take a look at <a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRSF/BCSRVSCRSF.pdf">SAP Smart Forms (BC-SRV-SCR)</a>
    Regards

  • Dynamic sorting in pivot view

    Hello
    Can someone please point me to the OBIEE Oracle documentation where I can find "How to make dynamic sorting work in a pivot table view".
    I have many pivot views on a dashboard. Clicking on the measure columns "Sort Ascending" and "Sort Descending" did not use to sort the columns in 10g. But I have found on this link
    https://forums.oracle.com/message/9321054#9321054
    that dynamic sorting can be now done in pivot views. But I am unable to find Oracle documentation on it that tells me how.
    We have upgraded to 11.1.1.7 but still I am unable to do sorting in pivot views on dashboards
    Thanks

    Devendra,
    you cannot have both status and status icon in the same column. so create a new column and then populate it according to the status.
    here is the sample code from the layout section of document_todo.htm
    <!--      Column: Appraisal Name                   -->
              <htmlb:tableViewColumn columnName = "AP_STATUS_NAME"
                                     width      = "150"
                                     type       = "IMAGE" >
              </htmlb:tableViewColumn>
              <%
                  data: status_icon type string.
                  if APPLICATION->T_DOCUMENTS_TODO-AP_STATUS = '2'.
                  status_icon = cl_bsp_mimes=>sap_icon( id = 'ICON_WS_PLANE' ).
                  else.
                  endif.
              %>
              <htmlb:tableViewColumn columnName          = "STATUS SIGN"
                                     type                = "user"
                                     title               = "STATUS ICON"
                                     horizontalAlignment = "center" >
    regards,
    manasa

  • Enable Dynamic Sorting in Tabular Report

    Hi All,
    I have 100's of reports and i need to enable dynamic sorting for the columns in tabular report.
    Just wanted to know which tag i need to put in advanced tab of the report where i can set the XML.
    Please guide

    Thanks Krishna..
    I have done that for one report and i want to do it for the remaining 99 reports.As i have to run each and every report and then enable dyamic sorting which is pain...so i was just thinking if there is any property in advanced tab of the tabular report where i can do it and then set the XML for the reports

  • Dynamic SORT with multiple components

    Hi all,
    I want to sort an internal table in this way:
    SORT itab BY (component).
    This is not difficult if "component" contains the name of ONE column of itab. But - and here is my problem - how can I sort with multiple components?
    Like this:
    SORT itab BY (comp_1) (comp_2) ... (comp_N).
    The number of components (N) shall be flexible. It is not possible to concatenate the components into one string-variable. This causes an error ITAB_ILLEGAL_COMPONENT.
    Brillant would be a solution which also contains the sort-direction (ASCENDING or DESCENDING for each component like this:
    SORT itab BY (comp_1) (dir_1)
                 (comp_2) (dir_2)
                 (comp_N) (dir_N).
    Is there a way to do so?
    Thanks for all hints!
    Mathias

    Hi Matahias ...
    From ABAP help...
    SORT itab.
    Extras:
    1. ... BY f1 f2 ... fn
    2. ... ASCENDING
    3. ... DESCENDING
    4. ... AS TEXT
    5. ... STABLE
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Field symbols not allowed as sort criterion.
    Effect
    The entries in the internal table are sorted in ascending order using the key from the table definition (DATA, TYPES).
    Addition 1
    ... BY f1 f2 ... fn
    Effect
    Uses the sort key defined by the sub-fields f1, f2, ..., fn of the table itab instead of the table key. The fields can be of any type; even number fields and tables are allowed.
    You can also specify the sort fields dynamically in the form (name). If name is blank at run time, the sort field is ignored. If itab is a table with a header line, you can also use a field symbol pointing to the header line of itab as a dynamic sort criterion. A field symbol that is not assigned is ignored. If a field symbol is assigned, but does not point to the header line of the internal table, a runtime error occurs.
    If the line type of the internal table contains object reference variables as components, or the entire line type is a reference variable, you can use the attributes of the object to which a reference is pointing in a line as sort criteria (see Attributes of Objects as the Key of an Internal Table
    You can address the entire line of an internal table as the key using the pseudocomponent TABLE_LINE. This is particularly relevant for tables with a non-structured line type when you want to address the whole line as the key of the table (see also Pseudocomponent TABLE_LINE With Internal Tables).
    If you use one of the additions 2 to 5 before BY, it applies to all fields of the sort key by default. You can also specify these additions after each individual sort field f1, f2, ..., fn. For each key field, this defines an individual sort rule which overrides the default.
    Cheers
    Preetham

  • How to implement Dynamic Sort to an SQL classic report?

    Hi,
    I'm trying to implement dynamic sort to my working sql classic report, when user selects order by column from select item(action as submit page), the report should be refreshed and display with the selected column sort order.
    But not able to do so.
    Report Query:
    Select a, b, c from sample order by :P1_ORDER_BY
    P1_ORDER_BY - Select Item:
    STATIC2: Column 1;a, Column 2;b, Column 3;c
    Running page, report doesnt sorts in any of the column priority.
    Kindly guide.
    Regards,
    Krishna

    Of course the select item is in use.
    It should submit the the page on select so you can retrieve the current value in you report select statement.
    look here:
    http://apex.oracle.com/pls/apex/f?p=21296:2:
    table:
    create table sample
      a varchar2(30)
    , b varchar2(30)
    , c varchar2(30)
    insert into sample values('a','z','k');
    insert into sample values('b','y','d');
    insert into sample values('c','x','a');
    insert into sample values('d','w','b');
    commit;
    Select List:
    P2_ORDER_BY
    STATIC:Order by A;A,Order by B;B,Order by C;C
    Report select:
    select
    a,b,c
    from sample
    order by
      decode(:P2_ORDER_BY,'A',a,null)
    , decode(:P2_ORDER_BY,'B',b,null)
    , decode(:P2_ORDER_BY,'C',c,null)Marc
    Edited by: telemat on Aug 24, 2012 1:50 PM

  • Dynamic sort

    Good afternoon Everyone,
    Expert Ammad Ahmed guided to dynamic sort in running time.
    if you want to make the dynamic order...then
    SELECT COLUMN1, COLUMN2...
    FROM TABLE
    WHERE ...
    &P_ORDER_BY -- It will create parameter in report called "P_ORDER_BY"
    So at the time of running report you will have to pass value in this parameter like this...
    ORDER BY FIELD_NAME -- Here field name is any field you want to order from your query.
    Moreover, nothing is simple for us.
    We have ORA - 00920 message and we wish more hands.
    Thanks in advance,
    NY

    Parameter with & Sign:
    Creating parameter like this called. Lexical Parameters. So lexical mean you can pass the statements in the parameters which can take place in main query. As i showed you for order by. So suppose if you use the query which you posed then query will create parameter as i mentioned before. Then you will have to pass the complete order by statement like this...
    ORDER BY column_name -- any one which used in select queryParameter with colon *:*
    It create normal data parameter. So. while running report user will pass single value for the parameter as you will use in query with = sign.
    -Ammad

  • Dynamic sort ascending / descending

    Hi all,
    I am trying to sort an internal table dynamically.
    In this table I have a number of field to use for an ascending sort and other used to sort descending.
    I have writen the code to create two fields (character field) in which I concatenate the sort field names.
    The result is :
    sort_field_up = ' field1 field2 field 3'
    sort_field_dn = ' field4 field5 field 6'
    and then i coded :
    sort itab by (sort_field_up) ascending (sort_field_dn) descending.
    But I get a dump ...
    has anyone ever done this ?
    regards,
    Nicolas

    Hi,
    only single fields can be mentioned in dynamic sort.
    REPORT  Z_DYNAMIC_SORT                          .
    data: sort1 type string,
          sort2 type string.
    data: begin of itab occurs 0,
           vbeln like vbak-vbeln,
           posnr like vbap-posnr,
          end of itab.
    "not possible to group the fileds.
    "sort_field_up = ' field1 field2 field 3'
    sort1 = 'VBELN'.
    sort2 = 'POSNR'.
    sort itab by (sort1) ascending (SORT2) descending.
    "or
    sort itab by (sort1) (SORT2) ascending .
    write sy-subrc.
    regards
    vijay

  • 2010 Dynamically Sorting Dates

    I am trying to dynamically sort Change Order Effective Dates.  The Change Orders are issued in sequence (CO1, CO2, CO3, etc), however their effective dates are (may) not be sequential by date.  I am trying to sort the effective dates and associated
    CO costs and other information) dynamically to show the historical sequence of the COs as they become valid change orders.  I'm hoping to do this without any user interface - i.e., automatically.  Any suggestions? 

    Two points to answer your question
    Writing a macro for Sorting - There are multiple VBA Code I found which will help
    http://database.ittoolbox.com/groups/technical-functional/excel-l/macro-for-sorting-with-dynamic-range-2922598
    http://social.msdn.microsoft.com/Forums/en-US/3081ad82-1e88-4bf1-829e-5e0bdbac8aae/excel-2010-vba-sort-dynamic-range-name?forum=isvvba
    How do you want to activate this macro ?
    There are inbuilt functions which gets called automatically (Selection change, Value change, Sheet activation etc.) You can call the above written macro here 
    Although the automatic solution is good I'd recommend not to go for it since the macro gets called more frequently than not ... Assign the Macro written in 1st step to a Simple Form control Button which does the job

  • Dynamic sorting in Cross Tab Report

    I have 2 cross tabs in a report with element linking that filters data in 2nd report when I click on values in the first. I'd like a way to be able to sort the results in the 2nd cross tab in ascending or descending order dynamically.
    Please see image below (click image for better quality) for a detailed representation of the problem.
    Is this possible?

    Right click on crosstab and go to Crosstab Expert and in the columns click on "group options" button and in the options tab select "Use a formula as sort order" and write the condition like this
    if {?Parameter}="Ascending" then
    crAscendingOrder
    else
    crDescendingOrder
    Hope this helps!
    Raghavendra

  • Dynamic Sort on table control

    Hi friends,
    I am having a problem when sorting the table control dynamically based on the fields selectd.
    sorting is not working, when you select multiple fields ( one numeric field and one character field )  I have written code for handling multiple field sort,gettting field names correctly, everything looks fine but internal table is not getting sorted.
    Is it related unicode issue..?
    Any help will be appreciated.
    Sample code:
    loop at tc_control into lc_cols.
      case lc_cols-selected.
             wehn 'X'.
        split lc_cols-screen-name at '-' into gv_tabname gv_fieldname.
        move gv_fieldname gs_struc+lv_off(20)
        add 20 to lv_off.
      endcase.
    endloop.
    if ok_code = 'ASCE'.
      sort itab by (gs_struc-field1) (gs_struc-field2) ..... ascending
    endif.
    Thanks in advance
    Thiru.p

    Hi
    Try using an internal table for the field names..
    Example
    DATA: BEGIN OF ITAB OCCURS 0,
            MATNR TYPE MATNR,
            WERKS TYPE WERKS_D,
          END OF ITAB.
    DATA: ITAB_FIELD(30) OCCURS 0 WITH HEADER LINE.
    DATA
    ITAB-MATNR = 'ABC'.
    ITAB-WERKS = 'ABCD'.
    APPEND ITAB.
    ITAB-MATNR = 'ABC'.
    ITAB-WERKS = 'ABC'.
    APPEND ITAB.
    SORT INTERNAL TABLE
    ITAB_FIELD = 'MATNR'.
    <b>APPEND ITAB_FIELD.</b>
    ITAB_FIELD = 'WERKS'.
    <b>APPEND ITAB_FIELD.</b>
    <b>SORT ITAB BY (ITAB_FIELD).</b>
    LOOP AT ITAB.
      WRITE: / ITAB-MATNR,ITAB-WERKS.
    ENDLOOP.
    Thanks
    Naren

Maybe you are looking for

  • I have a new MBP and this f$@$@$ a%$

    So i have a neighbor or T least I think so hacking into my Mac book pro. The MF can kick me off I thought I was going crazy until my pal found a hard partoton that cannot or at least I can't erase or unmount. It's untouchable and its got all my iport

  • Creating custom LAF - failing with 'unexpected error'

    Hi, I'm trying to create a custom LAF based on the simple.desktop. I follow the steps for 'Create Look and Feel' and enter - Name: test-desktop Family: test Description: Test LAF Base Look and Feel: simple.desktop click Next and the 'Customise Styles

  • Missing radio buttons on web pages, solution: remove Silverlight plug-in

    Missing radio buttons. When trying to use a page with radio buttons..they were not appearing. Cause: Microsoft Silverlight plug-in that was installed along with free Flip4Mac software. Solution: Remove file 'Silverlight.plugin' from /Library/Internet

  • Different visualization between parent-child dimension (obiee 11g)

    Hi! I have an assignment to do: In my dashboard I have a table with some entities on rows. There are some entities that I can drill-down but another entities not. If I click on column properties (Interaction->Primary Interaction (Default Drill) I see

  • Need Abap Code Help

    Hi , I am trying to activate an ODS but it is failing the activation process . When I look into the application log I see this error    "Value 'RAM???¿????????S RAM' (hex. '4D41524B3F3F3FBF3F3F3F3F3F3F3F3F5320574F524B') of characteristic ZEUID contai