Sorting in Cross Tab

Hi,
We are using the Cross Tab component in Crystal Report XI and the cross tab have the sorting option as ascending, descending and specific order.
The Sorting order will come from the query as an parameter, in that case how do we achieve the sort order in Cross Tab or how to use the sort in specific order.
Please provide the solution or any reference.
Thanks in advance.

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

Similar Messages

  • Sort in Cross-Tab report

    I have a cross-tab report that lists dates as headers and employees as rows. The data at every cell shows the qty (it is like timesheet report). The totals are shown for every row and column. The report layout looks something like this:
    ----------- <date> <date> <date> .... <Total>
    <name> <qty> <qty> <qty> <qty>
    <name> <qty> <qty> <qty> <qty>
    <name> <qty> <qty> <qty> <qty>
    <Total> <qty> <qty> <qty> <qty>
    The report definition looks like this (I numbered the columns to make it easier to write about them):
    01: <?horizontal-break-table:1?>
    02: <?for-each-group@column:EMPLOYEE_TIME;./TRANSACTION_DATE?><?sort:TRANSACTION_DATE;'ascending';data-type='date'?>
    03: <?TRANSACTION_DATE?>
    04: <?end for-each-group?>
    05: <?for-each-group:EMPLOYEE_TIME;./EMPLOYEE_NAME?><?sort:EMPLOYEE_NAME?><?variable@incontext:G1;current-group()?>
    06: <?EMPLOYEE_NAME?>
    07: <?for-each-group@cell://EMPLOYEE_TIME;./TRANSACTION_DATE?>
    08: <?sum ($G1[(./TRANSACTION_DATE=current()/TRANSACTION_DATE)]/TRANSACTION_QTY)?>
    09: <?end for-each-group?>
    10: <?sum ($G1/TRANSACTION_QTY)?>
    11: <?end for-each-group?>
    12: <?variable@incontext:T;.//EMPLOYEE_TIME?>
    13: <?for-each-group@cell://EMPLOYEE_TIME;./TRANSACTION_DATE?>
    14: <?sum (current-group()/TRANSACTION_QTY)?>
    15: <?end for-each-group?>
    16: <?sum ($T/TRANSACTION_QTY)?>
    The XML data is not sorted in any way and the report sorts it by employee and date. As you see at the line 02 I applied the sort by the transaction date. The sort works as expected, however the actual QTY are not showing at correct cells. If I remove sort it works fine but the dates are in random order. I suspect it is because I sort transaction date at header level and the QTY is not aware about it. I tried to apply the sort at line 07 but it does not help.
    Does anyone has any idea how to get this report to display data correctly?

    I have a SR which has associated bug 6131270.
    Here is the latest from my SR:
    UPDATE
    =======
    Hi Tomas,
    The bug has been updated. Development has recommended
    "You also need the patch from bug 4332399 to solve the java.util.EmptyStackException. "
    Please review above bug if you have access.
    Please consider applying Patch 4332399 - XSL:SORT FAILED IN A 2 LEVEL XSL:FOR-EACH-GROUP CASE
    Backport is included in patch 5840358 for EBS customers.

  • 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

  • Problems with sorting in cross tab.

    Hi,
    Can anybody help me? I use Oracle Discoverer Desktop 10.1.2
    The problem is:
    a have a cross tab in which at the left axis I have the items sorted by alternative sort. Among them there are two items with similar names, like "detail 1" and "detail 1", but with different recid and ordernumber.
    if I put only the 'name' of an item at the left axis - I see only one item with the name "detail 1", against both of them.
    if I put two colums at the left axis 'ordernumber' and 'name' - I see both, but there are additional lines with the same 'content' like:
    1     ;     100
    detail 1;     100
    2     ;     200
    detail 1;     200
    how can I avoid this and is there any way to see both item without ordernumber?
    Kate.

    Hi, Ott
    I use ordernumber only for creating alternative sort, not for publishing in the crosstab.
    Ordernumber only "prevent" me to publish the info I need correctly, if I put ordernumber in the table the duplicated rows appears.
    You see, the problem is:
    I need only the names of the details in the left axis, BUT the identical names of the details (with the different ordernumber) are displayed as one row, not as different. it is not correctly.
    what should I do to solve the problem?

  • Sorting a cross tab total

    I am a newcomer (user) to Discoverer so would appreciate some help.
    I have written a cross tab report which shows my sales people in the rows and different sales catagories in the columns. I have then put a total on my rows (total for each sales person) which works fine.
    I then want to sort my sales people by their "total sales" ie my calculation.
    Looking in the sort functionality I appear to only be able to sort the sales people by each of the actual columns of data which come back in the report (ie the sales categories - cat 1 or 2 as below)
    E.g
    Cat 1 Cat 2 Total
    Sales Man 1 10 15 25
    Sales Man 2 15 30 45
    I want to sort so that the 45 is viewed and Sales Man 2 is sorted to the top.
    Help?
    Ed

    Hi,
    Sorting a crosstab how you want is always difficult. If you only ever want two categories as column headers then it will be easier to use a table report and decode out the categories and sort by the total.
    Otherwise you will have to use a analytic sum with a partition to calculate the total for each sales in a calculation and then include that calculation as a dimension. You will then be able to sort the crosstab using this dimension and if necessary hide the content of the field using formatting.
    Rod West

  • Customized Sort for Cross-Tab Row

    I have a simple Cross-Tab on my report that needs to be sorted in a static Row order.
    My cross tab has 1 Row (Name) and 1 column (Total Sales).
      Currently the CrossTab sorts the Name Alphabetically (ASC). But I need to specify a specific order.  I have added a numeric field to my table and I assign a numeric value to the last names so that I might be able to sort the Name Row based on my "CustomSortOrder" numeric field.
    Currently it looks something like this:
    A
    B
    C
    D
    E
    I want it to be: (numeric value behind the scenes)
    C (1)
    D (2)
    E (3)
    A (4)
    B (5)
    ALL OTHERS (9999)
    I cant seem to figure out where I need to set this.  I have tried adding a group to the report. I have tried setting the Report Sort order.  I am out of ideas.
    Any help would be greatly appreciated.

    Hi Jimmy,
    Here's what you need to do :
    1) Go to the Crosstab Expert > Remove the existing 'name' field from the 'Row'
    3) Add the numeric field as the 'Row'
    4) Select the Row > Group Options > Options Tab > Customize Group Name Field > Use formula as a Group Name > Click the formula button beside and use this code:
    If {numeric_field} = 9999 then "All Others"
    else
    {Name_Field}
    -Abhilash

  • Sorting a Cross-tab in both directions

    I'm using CR2008. I have a list of doctors, facilities, and their monthly charges. If I put Doctors down the left and Facilities across the top, I can sort Doctors by order of charges descending, but I can't see how to sort Facilities the same way. Anybody know how to fix this? Thanks.
    P.S. -- works just fine in Excel, but I was hoping to convert it to CR so I could put it on the CR server.
    Edited by: Garrett Fitzgerald on May 11, 2009 1:57 PM

    It's not a subgroup. As I said at the top of the thread, Doctors are the rows, Facilities are the columns, and Charges is the summarized field.
    Excel will let me sort both the Rows and the Columns by the summarized field at the same time. Will Crystal?

  • Cross Tab Sorting

    Hi,
    I have a cross tab report, i am summarizing total amount field i.e. is JSCOUNT, i want to sort the records with this field(JSCOUNT).
    how to do the sorting in cross tab with summarizing field[JSCOUNT], please help me
    Thanks
    Venkat

    Venkat,
         I have CRXI, click on the crosstab, (Top left corner) go to Report
    about half way down, you shold see group sort expert.  If you do not,
    you may need to click somewhere else on the crosstab.
    Note:    A report must contain a summary value in order to be able to perform a Group Sort. See Summarizing grouped data.
    Use the Group Sort Expert to identify top or bottom groups (the states with the most/fewest customers in a customer report, for example). You can also identify top or bottom percentages.
    Click Group Sort Expert
    in the " For this Group Sort"  section, select all
    you should see your summary value listed, and be able to select it now.
    Hope this helps.

  • Top N sorting in a Cross Tab object

    I am looking for information on how to sort a cross tab object using a Top N filter.

    Hi Lee,
    In the cross tab report, just insert a chart, with in the data tab when you insert the data base available values then you can observe on change of record values and summary field values.
    In the record sort values we can give the sorting with the order level or Top N level.
    Let me know if you have any queries.
    Thanks,
    Naveen.

  • Cross-tab column name sorting

    Hi
    I created a cross-tab report in Bi Publisher, the sorting in the column names is sorted in alphabetical order. How do I customize this in the order I expected?
    Thank you in advance,
    Jean

    Thank you Jorge!
    I used the pivot table to create the template in word. I check the link and it is what I need. But the template I created is so different. I am very new to BI Publisher. the following is the what I have in the field browser:
    crosstab:c547;"//ROW";"ETHNIC{,o=a,t=t}";"S_TYPE{,o=a,t=t}";"EMP_ID";"count"?>
    <?horizontal-break-table:1?>
    <?for-each@column:$c547//C1?>
    <?./H?>
    <?end for-each?>
    <?for-each:$c547//R1?>
    <?./H?>
    <?for-each@cell:.//R1C1?>
    <?./M1?>
    <?end for-each?>
    <?./T1?>
    <?end for-each?>
    <?for-each@cell:$c547//C1?>
    <?./T1?>
    <?end for-each?>
    <?$c547//M0/M1/T?>
    How do I make the S_TYPE in my order, like the sample you gave me (Wednesday before Thursday)?
    Thanks,
    Jean

  • How to perform sorting in a Cross-Tab report?

    Hi,
    Please advice, how sorting can be done in Crosstab report.

    Hi Sriram
    Using the group option you can get the ascending or descending sort order however if your requirement is other than that, you can use a specified order as below:
    To create a specified order for the column or row headings in the crosstab complete the following steps:
    1. Right click the cross tab to select it and from the fly out menu select 'Format Cross-tab'.
    2. In the 'Format Cross-tab' dialog box, select the field that you would like to change the order of. In this example, it is{Customer.Country}.
    3. Click the 'Group Options' button from the right side of the 'Format Cross-tab' dialog box.
    4. Select 'Specified Order' from the drop down list box on the 'Common' tab. This takes you to the 'Specified Order' tab.
    5. From the drop down list box on this tab, select the field values in the order you would like them to appear on the cross-tab.
    You can specify the conditions as per your requirement there.
    Hope this helps!!
    Regards
    Sourashree

  • Sorting by date in columns cross tab report.

    Hi all,
    I am working on a cross tab report in BI Publisher in which columns are generated dynamically in a pivot table depicting months as Jan 09 , Feb 09.... but data type is char.When displayed in pdf, columns are generated sorted alphabetically.
    How can I have them sorted by date in final pdf?
    or
    How can I stop the columns being sorted in pivot table at template level?
    Thanks.
    Edited by: user9061488 on Jul 21, 2010 1:13 AM

    You need to get a extra column in the query just for sorting purpose, which will have month number in it or YYYYMMDD. format, so that , it can be used in only for sorting.
    with JAN 09, FEB 09 , we can do it, but it will be little complex

  • SORTING FOR THE CALCULATION FIELD IN CROSS TAB REPORT

    LIST_G_AUCTION_TITLE>
    <G_AUCTION_TITLE>
    <BID_NUMBER>5002</BID_NUMBER>
    <AUCTION_TITLE>E2E-01 Construction RFQ</AUCTION_TITLE>
    <ITEM_NUMBER>C2631</ITEM_NUMBER>
    <ITEM_DESCRIPTION>4G000,000,0STRUC,X,SPECIAL STRUCTURE</ITEM_DESCRIPTION>
    <ESTIMATED_QTY>1</ESTIMATED_QTY>
    <UNIT>LS</UNIT>
    <QUOTE_PRICE>400</QUOTE_PRICE>
    <ESTIMATED_QUOTE_PRICE>400</ESTIMATED_QUOTE_PRICE>
    <SUPPLIER>X - L CONTRACTING</SUPPLIER>
    my xml data is in this format, i created a cross tab report for ITEM_DESCRIPTION as row and SUPPLIER as column and calculated a sum(ESTIMATED_QUOTE_PRICE)
    for all the ITEM_DESCRIPTION for every SUPPLIER in templete . now i need to sort the data by sum(ESTIMATED_QUOTE_PRICE) from lowest to higest from left to right , that is supplier with lowest sum(ESTIMATED_QUOTE_PRICE) should display first from left to right.
    can any one help thanks in advance.

    thank you tim , for asking i got the solution. it is actually in template builder i was asking about. xml template builder

  • Can we apply sorting on Column values in Cross tab??

    Can we apply sorting on Column values in Cross tab??
    Following is the scenario with me.
    I have 2 fields and one formula.
    Fields are HostName and Username.
    Formula is status which categorizes the Authorized and Unauthorized events.
    And in the Summary Field, I am calculating the total number of events.
    In cross tab, Fields are marking the Rows of the cross tab and Formula is making the Columns(Authorized and Unauthorized ) of the cross tab.
    Since in cross tab data is grouped from left to right and sorted by default. I want to remove this default sorting and want to put sorting on the formula for Unauthorized events.
    Is there any way to fulfill this requirement?

    Hi,
    You can assign a number to each Unauthorised field e.g
    Rank   Unauthorised
    1         A
    2         BC
    3         DF
    5         TD
    6         GF
    Then add "Rank" to the crostab Columns before the Unauthorised  field. Then you can control the sorting order on your crosstab.
    Hope this helps
    Regards
    Dotun

  • Sorting column name in cross tab

    Hi Experts,
    How to sort the column name in cross tab.Crystal is sorting alphabetically like
    Apr 2013 Apr 2014 Aug 2013 Aug 2014 Dec 2013 Dec 2014 Feb 2013 Feb 2014 Jan 2013 Jan 2014............................so on
    But i need result like
    Jan 2013 Jan 2014 Feb 2013 Feb 2014 Apr 2013 Apr 2014 Aug 2013 Aug 2014  Dec 2013 Dec 2014
    I am using crystal report 2013 version.
    Kindly see the attached file

    Hi Bharathiraja,
    Instead of using a string field to display the month names, use a Date field as the column of the Crosstab.
    You can then, highlight the column in the crosstab expert > Options > Options tab > check 'Customize group name field' > click the formula button beside 'formula' and use this code:
    Totext({DATE field}, 'MMM yyyy')
    -Abhilash

Maybe you are looking for

  • Nokia lumia 820 camera

    I need heeeelp. My camera can't take pictures or video anymore. When I click on the camera button it brings a black screen for a second then goes back to the menu. It is like if it is not activated. This phone just gives me headache. It also usually

  • Updated Bridge and PS CC, added Output module - Bridge now slow

    Trying to figure out why Bridge is lagging.  Prior to the updates I ran a week ago, everything was fine.  Now that I have 6.1.0.116 x64 - I click and wait.  And wait some more.  And wait and then finally, about 10-15 seconds later, Bridge comes back

  • Frequency Analysis on Adobe Audition CS5.5 for bioacoustics research

    Hi everyone, In need of some help. I research whale/dolphin sounds, and have previously used Raven Pro for analysis. Ive found Adobe Audition produces a much better spectrogram (think it must be the FFT algorithm) and allows me to visualize a lot of

  • PO Currency different than PIR

    Hi, We recently changed the currency on a PIR but when creating a PO for the material and vendor, it's defaulting to the old currency. The company code currency is still the old currency.  Could that have something to do with it? Thanks ~ Chris

  • RDBMS version

    The minimum requirement stated for headstart 6.5.3.2 for designer 9i is rdbms 9.2.0.1. Why is this the minimum requirement? Designer 9i was certified against 8.1.7.4. Only because of desupport of 8i the certification was halted. With kind regards, Ro