Grouping but dynamic sorting

I am grouping my records based on one field, say TestID, but I want the report can be sorted according to a prompt parameter, say TestID,TestName or TestLocation, assuming both at the same grouping level.
The output is like this
TestID1 | TestName1 | TestLocation1
                                    UserID | UserName
                                    UserID | UserName
TestID2 | TestName2 | TestLocation2
                                   UserID | UserName
                                   UserID | UserName
I am using XI R1. Thanks for any advice.
Edited by: Peter Wang on Sep 24, 2008 12:28 AM

Hi Peter,
I'm not sure I understand the question completely,  however from what I'm interpretting you could create a parameter field and a formula in Crystal Reports.  For example,
- create a string parameter named "SortParameter".
- create a formula named "SortFormula".
In the formula you would enter similar text:
whilereadingrecords;
if {?SortParameter} = 'TestID' then {testID.field}
else
if {?SortParameter} = 'TestName' then {testName.field}
else
if {?SortParameter} = 'TestLocation' then {testLocation.field}
- next you would Insert|Group and select your {@SortFormula}  field to group on.
Regards,
Wallie

Similar Messages

  • How to dynamically sort cached CR instance accessed via opendocument

    I am currently accessing cached CR instances via an opendocument call (from XC dashboard) that filters the records on display using &sf in the opendocument call to display only the records that match the criteria selected by a user. These instances are refreshed weekly and accessed hundreds of times throughout each week.
    I have new requirements where the users want the records in the CR instance to be sorted differently depending upon what they have selected. I have been trying to do this with a formula based on the recordselection() and while this works fine if I am refreshing the report, it does not when I am filtering a cached instance because the recordselection() is not being evaluated at the proper time (I suspect). If I evaluate the recordselection() whileprintingrecords then I can get access to the selection filter value but I cannot group on the dependant formula - I get the error "Group specified on a non-recurring field".
    Does anyone have any ideas on how I can accomplish this goal without forcing a refresh on the report (which is not an option based on volume / performance needs)? I am happy to provide more detail if needed.
    Thanks in advance...

    Salah / Ashwin,
    Thank-you both for the suggestion.  I am using CR2008 so bind sort control is available for my usage however it does not solve my problem exactly. I really need to dynamically group and sort on the group...   Here is some more detail for you to consider.
    The CR I am accessing is grouped based on a customer ID.  Each customer ID can have many detail rows (which are suppressed on the report always).  Each detail row contains the band value for each trait which can be analyzed in the parent XC dashboard.  When the CR instance is accessed via the opendocument call from XC, there is a selection filter applied so that only the detail rows that meet the criteria of the selection in XC are included for consideration in what is displayed in CR.  What I have found is that the bind sort control can work within a group, but I need this to supercede the group sorting because otherwise I am just sorting the trait within customer and I could never get the list sorted in such a way that the customer with the largest or smallest value in a trait field is first because the grouping by customer ID always is the primary sort.
    What I wish I could do, was set the group field to be set dynamically based on the recordselection sent from the XC dashboard.  Then, if the request to filter the report came based on the sales trait, it would be grouped by sales number.  If the request came based on customer age, it would be grouped / sorted by customer age.  What I am finding here is that I cannot group by a formula that is evaluates the recordselection whileprintingrecords, yet I need the recordselection to be evaluated at that time in order to accurately pick up the selectionfilter passed in the opendocument call.  Any ideas on this?
    I am also toying with the idea of getting rid of the groups altogether and just displaying detail with identical rows suppressed.  this will be a bit of a comprimise for our users because I don't know how I can show the total number (a sum) of records in the detail section.  If I can get them to agree to that, I think that I can create a formula based on recordselection that I can bind sort control to -- Just tested and found out that I cannot sort on a formula that evaluates recordselection whileprinting records so this may be out the window too...
    Of course, all this would be relatively easy if I could just referesh the report on demand when accessed but that is not a viable option due to a number of reasons.  Any help / suggestions on this are greatly appreciated!!!
    Edited by: Steve Fowler on Nov 2, 2009 4:07 PM

  • 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

  • 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

  • Russian and English combined Index Group Title and sort order

    How should I create the combined index Group Title and sort order in Russian and Greek documentations?

    The final product one Russian manual which contains some English Index marker ...
    And what is the problem?
    You can control the sorting by placing a [...] tag in the Marker Text, such as:
    [Сплайн] Spline
    The term(s) in the brackets are used only for sort. What appears in the Index is the following text.
    Or you can just edit the Marker Text.
    But it sounds like there might be more than one question here, re: Group Titles.

  • 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

  • Hash GROUP BY And Sort GROUP BY

    Can anyone please explain how does Hash GROUP BY And Sort GROUP BY exactly work ?
    Thank you.

    As the name suggests, SORT GROUP BY achieves the same goal by sorting.According to Tom SORT GROUP BY doesn't always sort correctly .. tried to understand his explanation as he said "It always did a BINARY SORT - not a character set sort. So the data would be sorted incorrectly if you use anything but very simple ASCII strings..."
    can you give me an example where binary value of a string A is greater than string B while ascii value of string B is greater than string A ?
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:75397449124988
    Thank you

  • Dynamic Sorting

    Is it possible to let users re-sort data in a Crystal Report by just clicking on a column heading? 
    For example the default sort is by name . . .
    Name                 Zip
    Jane Doe           60999
    Sue Smith          60001
    but the user re-sorts by zip by clicking the zip heading/column . . .
    Name                 Zip
    Sue Smith          60001
    Jane Doe           60999
    If possible please advise how to construct.  Your help is appreciated.

    I created a prompt sort option for my reports, which allows you to sort by none or any number of fields on the report, it is not static.
    1. Find the total number of sorts you will have for the report (in my case, 8).
    2. Create a formula for EACH sort i.e. "Sort Group 1", "Sort Group 2", etc
    3. I then created a prompt called "Sort Option" - Multiple values, optional (CR 2008), Number. I assigned 1 - 8 with descriptions of my fields I wanted to sort by.
    4. For "Sort Group 1" I used this formula:
    numbervar array sort;
    redim sort [8];
    local numbervar i;
    for i := 1 to 8 step 1 do
          sort<i> = i;
    local numbervar h;
    if (hasvalue({?Sort Option}) then
    for h := 1 to ubound({?Sort Option}) step 1 do 
         sort[h] := {?Sort Option)[h];
    select sort[1]
    case 1: {xxx.Customer}
    case 2: totext({xxx.sale_Date})
    etc etc etc
    5.  Use this formula for EACH 'Sort Group X" formula, and simply change the "select sort[x]" as needed.
    6. Assign a group to each "Sort Group number, suppressing headers and footers as needed. 
    This will allow you to select on your parameter, in order, the sorting that you want.  The sorts will cascade to whatever you select, and in the order you select them.
    HTH
    Chad

  • 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

  • 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

  • I have windows 7 64 bit, Core i5, I have tried every option identified in the discussion groups but still cannot connect to the iTunes Store, any ideas?

    I have a brand new Core i5 Windows 64bit laptop, but cannot connect to the iTunes Sore.  I have tried every solution suggested in the discussion groups but I still cannot connect.  This includes completely removing all security and firewalls, and I still cannot connect.  I have re-load the software in different combinations again to no avail.  Any ideas anyone?

    Could you walk us through what happens (when you try to connect to the Store) in some more detail, please?

  • I'm using a Dell Inspiron 7520 ... pretty new. Sometimes when I download a CD / album to my library acouple of tracks get separated away from the main group. I've tried to click and drag the stragglers over to the main group but it doesn't work. Any Ideas

    .When installing a CD/album into my library some of the tracks get separated away from the main group of tracks. I try to click and drag the stragglers to the main group but it doesn't work. My laptop is using Windows 8. My old XP laptop didn't have this problem. I'm not sure if that has any thing to do with it. Any ideas would be appreciated. It's more of an irritation than a problem but if it can be solved, it would be a good thing. Thanks!         Paul 

    Hey Paul,
    If I understand correctly, it sounds like iTunes is not grouping the songs from a particular CD together. The cause could be something as minor as a misspelling or slight variations. For more information, see the following resource:
    Why aren't songs with the same album art grouped together?
    http://support.apple.com/kb/TS1468
    Thanks,
    Matt M.

  • How can I leave a group in iMessage. I delete the group, but whenever a member sends a message, I get all the messages again

    How can I leave a group in iMessage?
    I delete the group in iMessage because I don't want to receive any more messages.
    Nevertheless, whenever a member sends a message, I get all the messages again. I have only deleted the previos messages.
    In the users manual, they only tell how how to create a group, but not how to leave it.
    Thank you.

    Sorry you can't.

Maybe you are looking for

  • Will Mac Mini with OSX Server 10.6 Snow Leopard be able to fit my needs?

    Hello, The office i work in is a Mac environment. Is this unit powerful enough to support 20 people? This is the setup i was thinking: Mac mini with Snow Leopard Server - 2.66GHz : Dual 500GB: 1st Internal drive - OS only 2nd Internal drive - OS back

  • DYNAMIC PROGRAMMING IN WEBDYNPRO ABAP.

    Hi Experts How to create input field dynamical and when i click on the input field drop down ui  should display,If i click n time the input field that many drop down should be displayed this should be done using dynamic programming. Waiting for Reply

  • Please Help! Invalid Drive: E:\

    I currently have itunes 6 but for the last few months, whenever i have tried to install a more up to date version it says 'Invalid Drive: E:\' This is after the 'Run' process and on the final installation phase. I really want the newest version as i

  • How to get the class file of jar file

    hello all, is there any way to get the class file of jar file,as we have when we compile a java file we get class file same do we have any option to get the class file of jar file

  • Install Edge on different drive

    I have a small SSD for my C: (OS) drive, so I install all of my software on my D: drive.  In Creative Cloud -> Preferences -> Apps  I have the install location set as:  D:\Program Files\Adobe CS It works for most of the apps, but the Edge apps still