Parameter-driven group sorting?

Post Author: craibuc
CA Forum: General
i have a report that is grouped by employee name.  the report has 7 columns, displaying a summarized field in the group header.  the summarized values are based on formulae that are evaluation in the Details section.i would like to be able to dynamically sort the group based on a parameter value.  the parameter would allow the user to sort either on one of the week days or on the employee name.in the past, i have been successful sorting the Details section based on a parameter, but sorting a group is challenging. has anyone been able to do this?

Post Author: Charliy
CA Forum: General
If you want to do Parameter driven grouping:  You have a formula:  IF {?GroupBy} = 1 THEN {table.EmployeeName} else IF {?GroupBy} = 2 THEN {table.SomethingElse}
You may have to use Totext or some other function to make them the same data type.  Group on that formula.  If one of the options is something like day of week, or a date or portion of a date (YYYYMM), then create another formula for display in the group header.
IF you're talking about sorting within a group -  same formula, you just use the sort expert to put it after the grop field in the sort sequence

Similar Messages

  • Use parameter to specify "N" in Top N Group Sort

    I've successfuly set up a parameter which is passed to the Group N Sort criteria.
    Is there a way I can use this to set NO group sort? I've tried setting it to zero & 999999999 but it falls over.

    I think you can enter the values only between 1 to 32767. You can try creating a sample report with groups in it and go to group sort expert and select top N and try to add the value 0 then you will get a popup saying "Please enter an integer between 1 and 32767"
    Regards,
    Raghavendra

  • GROUP SORT PARAMETER

    I have a report with a group sort of the "Top N" items based on profit.  I already have a parameter that allows the user to specify the "N", but I want to also give the option to change the group sort based on sales or units sold.  Is there a way to do that?

    hello all,
    actually Brian's solution is correct...i use this method all the time.
    add two more steps to his solution...you should have created a formula with syntax
    Select {?GroupField}
       Case "Sales" :{table.SALES}
       Case "Units Sold" :{table.UNITS_SOLD}
       Default :{table.SALES};
    1) now add this formula to the details section, right click on it, and add a Summary, type = Sum.
    2) now go to the Group Sort Expert and add the formula, removing any other sorts in there already.
    you can now sort the groups on this formula that he gave you.
    if you have crystal reports 2008 or 2011 you can also use Interactive Sorts instead of using a parameter / prompt.
    cheers,
    jamie

  • How do I change the number in a Top N Group Sort

    I have a report that I have grouped on a particular field (Cust.Name specifically). I then used the group sort expert and selected the Top N selection in the combo box under the Cust.Name tab. I put in a default number of 20. What I want to do is to set this number for the Top N group sort via .NET. Does anyone know the correct method for doing this in either VB.NET or C#.NET. I am using VS 2005 Pro and the embedded Crystal Reports engine for VS.NET. Thank you.
    Ed Cohen

    Hello, Edgar;
    In the bundled version of Crystal Reports 10.2 in Visual Studio .NET 2005 you will need to use the following code:
    Private Sub Set_TopN()
            Dim TopNSortField As TopBottomNSortField
            'Get the Sort field by index
            'Cast it as a TopBottomNSortField
            If TypeOf crReportDocument.DataDefinition.SortFields.Item(0) Is TopBottomNSortField Then
                TopNSortField = crReportDocument.DataDefinition.SortFields.Item(0)
                TopNSortField.NumberOfTopOrBottomNGroups = 10
            Else
                TopNSortField = Nothing
            End If
        End Sub
    In a full version of Crystal Reports there is an option to create a parameter as a number such as {?TopN} and then pass the value to it at runtime.
    In the Crystal Reports designer you need to create the parameter and then go to Report|Group Sort Expert.
    Choose TopN based on your field.
    Where N is... You will need a number there. I used 1. But then I clicked on the Formula editor [X+2] and added the parameter field {?TopN}.
    Passing the parameter at runtime ran the number I requested.
    Elaine
    Edited by: Elaine Dove on Mar 3, 2009 12:12 PM

  • Sum of a sum when using Top N in the Group Sort Expert

    Hi All,
    I have a small problem I can't quite seem to work out.
    I have a report where each line is for a particular Product, and is a summation of the Sales for that Product over several Locations. When you click on the line, it shows the breakdown of Sales over each Location.
    I use the Group Sort Expert to display the Top N results, where the 'N" is set in a formula to a parameter passed in to the report, so the user can select the top 5,10,50 etc. Products across all Locations.
    At the bottom of the report, I want to have a sum of a column of Sales $. I need that sum to only be a sum of the Top N records selected.
    Since each line is a summation of the all the products for the Locations, what I need is a sum of that sum for the Top N, but Crystal will not let you add the sum of a sum, so I'm not sure how to accomplish this.
    If I just do a sum of the underlying values I get a total for all the Products, regardless of the Top N.
    Hope that makes some sense !
    Many Thanks
    Paul

    Hi Sastry,
    I tried your suggestion, thanks, but I don't think it's the answer. For a start Crystal will not let me do that, it pops up a message box when I try to run the report "A running total cannot refer to a print time formula. Details: Record Number". I also added the record number field next to the lines in the report to see what the result would be, and I don't think it would work anyway.
    Here is an example using Units sold:
    Product Name--LocationUnits Sold--Record Number
    Product A -<All Stores>----8
    Store A--1--
    1
    Store B--3--
    2
    Store C--4--
    3
    Product B--<All Stores>--3      
    Store A--2--
    4
    Store B--1--
    5
    Product C--<All Stores>--
    1
    Store A--1--
    6
    Note that only the bold lines are shown in the report,. If you click on the bold line, then the breakdown of the stores is shown. For the above example, I am showing the Top 2 units across all stores (so Product C is not shown at all), but there are actually 5 records, so if I used a formula where RecordNumber <=N, where in this case N=2, I would get a total units sold of 1 + 3 (records 1 and 2) which is incorrect.
    I will have more of a think on this and see if I can find a solution, in the mean time, any other suggestions ? Is there some wya of checking if the line is visible maybe ?
    Thanks for your time !
    Paul

  • Group Sort Expert Top N

    In Group Sort Expert I have a group called @Sku and I want to select the top 500 based on Sum of @SortByData which works except the totals are for the whole group and not just the top 500.
    Also I would like to select Ascending/Descending based on a parameter field IN the Group Sort Expert since I'm using a based on field (not in Group Expert Change Group Options).

    Hi sharonamtowler,
    My requiremnet is TOP N Materials based on the Current Availiable Stock in each Plant.  In CR from my db, I get four records in Details section for each Material (on 4 weeks, let say 48,49,50,51 ) of a Plant.
    I have grouped on Plant & material. 
    But to get Top N Materials I have to do Summation(Current Availiable Stk) which mean in My Material Group Section I get the Sum of Current availibale Stock of 4 weeks. But I need Top N based on the last weeks Current Availible Stock.
    How to do this?
    I left Plant in Group Sort Expert with No Sort and on Material I have given TOP N.
    I need to know whether only Summation Values should be used in Group sort expert ?
    please some help me solvethe issue.
    Edited by: KRISHNA CHAITANYA B on Dec 29, 2009 6:12 AM

  • Group Sort ALV

    Hi,
    Is it possible to group sort on ALV?
    it seems we are able to merge together several rows via sort but only on its field level.  is it possible to be a group field level?
    example if i sort PO number first and vendor second it will have individual PO and the vendor field is merge together if it is the same with a different PO.  Can we make the PO number as the first priority sorting without changing the position of the fields?

    c z wrote:
    Hi,
    >
    > Is it possible to group sort on ALV?
    >
    > it seems we are able to merge together several rows via sort but only on its field level.  is it possible to be a group field level?
    >
    > example if i sort PO number first and vendor second it will have individual PO and the vendor field is merge together if it is the same with a different PO.  Can we make the PO number as the first priority sorting without changing the position of the fields?
    If I have understood your requirement correctly, group sorting should be as simple as filling up the 'IT_SORT' parameter(REUSE_ALV_GRID_DISPLAY/REUSE_ALV_LIST_DISPLAY/CL_GUI_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY)
    as shown below: (please let me know if I have misunderstood your requirement).
    ls_sort-spos = '1'.
      ls_sort-fieldname = 'FIELD1'.
      ls_sort-up = 'X'.
      APPEND ls_sort TO it_sort.
      CLEAR ls_sort.
      ls_sort-spos = '2'.
      ls_sort-fieldname = 'FIELD2'.
      ls_sort-up = 'X'.
      APPEND ls_sort TO it_sort.
      CLEAR ls_sort.
    Even after displaying the ALV, columns can be group sorted by selecting all of them together(by dragging the cursor over all the columns that need to be sorted)
    -Rajesh.

  • Series group sorting

    Hi
    I am facing one problem. In my report i need to change chart order series group sorting by report parameter
    value. Is it impossible?
    thanx in advence.

    Hi Unbeliever,
    Per my understanding you have an parameter and the order of the series group will sort based on the  value in the parameter selected, right?
    I assumed that you have two values in the parameter(ASC,DESC) to define the order. you can add an expression in the Series group to change the order based on this parameter.
    Details information below for your reference:
    Right click the Series group to select the "Series Group properties".
    Select the "Sorting" and add expression below to conditional change order(By default the order is ASC):
    =IIF(Parameters!Order.Value="ASC",Fields!CarModel.Value,switch(Fields!CarModel.Value="LXI",5,
    Fields!CarModel.Value="Test1",4,
    Fields!CarModel.Value="Test2",3,
    Fields!CarModel.Value="VXI",2,Fields!CarModel.Value="ZXI",1))
    Preview you will got the chart display as below:
    If your problem still exists, please try to provide more details information about the value in the parameter and also sample data in the table and so on.
    Regards
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Top N Group Sort

    Hi all,
    I have a report that does a group sort just to show the top 20. I've been asked to do one to show top 50.
    Rather than having two reports can I pass 20 or 50 as a parameter to the group sort? If so, how is this done?

    The 20 is currently set in the group sort expert.
    So ideally I'd like to pass 20 or 50 as a parameter to it but I can't see how to do this.

  • Generating  Parameter driven Reports

    Hello Group,
    I am working on a assignment to generate parameter driven reports. Here is the detailed description:
    1. End user access Report A.
    2. From Report A, the user selects a row from Report Aand passes the
    deptno to Report B
    3. Report B is then generated
    Below is a diagram of the process.
    User--(User Accesses Report A)--->Report A is generated with columns
    deptno and deptname--(User selects Row X from Report A)--->Drop down
    list of other reports (Report B and Report C) appears--(User selects
    Report B)--->Report B is generated with columns empno and ename with the
    Report A, Row X, deptno value as the parameter.
    I need to display a static list of Report Names when a user clicks on DeptNo. Would like to know whether we can associate a Link to LOV or DropDown List.
    Thank You for u'r time in advance
    Bansi

    Hi,
    What u could do is create a FORM instead for REPORT "A". The form has a combo box with the values.
    On selecting one of these values from the combo box ,you could write a stored procedure that would call the corresponding report with the value you just selected.
    Thanks,
    Anu

  • Group Sort on formula field

    I am using CR Professional 11.5 on Windows XP/Progress platform.
    I have a formula field that calculates the GM% on the Employee Group Footer level and want to sort the employees in descending order by GM%.  I have gone in circles trying to calculate this field differently in order to be able to perform a Group Sort but this GM% cannot be summarized, which would allow me to use the Group Sort Expert.
    The fact that GM% is used in businesses world-wide each and every day makes this unbelievable that it should prove to be this difficult.  Is there something that I am missing as a newbie to CR design? 
    Any help provided is greatly appreciated!
    Marlene Human

    That's so awesome!  If only I knew how to use sql commands!  Everytime I try to create one it has errors that I dont' understand.  Do you know of a site for sql syntax that might help me to do this?  I have looked and can't find what I need to make this happen.
    So what I need to do is to use 'Formula Workshop' and create a new SQL Expression Field?  Using the formula above, how would this look in SQL?
    Thank you so much for your help...I am so grateful!!!  I have been working on this for months and keep hitting this snag.  I first started out using a cross-table and got confused because you can't summarize the GM% so I then changed the summary to 'weighted average of GM% with Tech/Rev' so that helped, but the Total per Employee has been keeping me stumped. 
    Thanks again.

  • Group/Sort Summary Totals for Duration % Complete not working

    Hello, I'm new to this forum and have used p3 off and on years ago and had some exposure to p5, my background is more toward Project Controls - Cost management rather than scheduling. Here is my issue/question: I was told by the PM not to baseline the schedule (I know, I should have but I didn't, I did as I was specifically requested), that is a topic for another day, however. I am trying to understand the process of the % completes on my resource loaded schedule which all activities are set to duration percent complete. The schedule has roughly quarter of the activities which have been actualized, but my issue is with the "Summary Totals" of the duration % complete when I select that option in the Group/Sorting. All of the activities in a group for example will show 0% complete but the Summary Total of those activities will show greater than 0% or some of the activities duration % completes show a value greater than 0% but the Summary Total of those activities show 0%. What is causing this and why are they not consistent? Any help is greatly appreciated!
    Shannon

    I'm currently showing the duration % complete with a renamed label. The total is not rolling up to the summary. I've also discovered that the unit % complete is not calculating correctly too I believe. For example: I have 3708 budgeted hours and have expended 656 hours and the Unit % Complete is showing 19.08% when I would have thought that the % would have been calculated based on Actual Units (656) / Budgeted Units (3708) totaling 17.69% not 19.08% which it is showing. I cannot find in the reference manual how the percent completes are calculated for units nor in the help section of the software itself either. An explenation would be greatly appreciated!
    Shannon

  • Group sort using 2 fields

    Is there any way that I can have two fields as a group sort in order that the first group sort field will repeat when the second field changes?
    Thanks.
    Leah

    One possibility would be to create a calculated item (ItemA||ItemB), and use that as a hidden group sort. Not sure about your platform, but in Desktop, you need to specify the item as a 'group' sort, then change it to 'hidden'. You would still display your original items, but don't sort on them.

  • Group Sort Option

    I have a formula on a group level.  That is in basic sum(x)-sum(y)/sum(y).
    I need to use this as a group sort option and it does not seem to allow me to

    Hi Brian,
    In order to sort with the result of sum(x)-sum(y)/sum(y) use the group sort order based on sum(x). Since we cannot sort on the result of the formula that contains summaries.
    Thanks & Regards,
    Raghavendra.G

  • Group Sort Filtering

    Hi
    I have a report which has a group sort on number of days sickness leave for employees over a period of a year .
    Is there a way of setting a condition on the group (sub) total to exclude total sickness less than 8 days and the individual lines that make up the sub total?
    Or could you advise of an alternate way to do this.
    So to recap I need to exclude employees whose sickness total for a year is less than 8 days.And the report lists individual entries of sickness for a year by employee.
    I am using Discoverer Desktop version 4.
    Thanks
    Edited by: user650649 on 23-Jul-2010 02:28

    Hi,
    In general, you can do this by using an analytic sum function in a calculation. So you would calculate the total number of days sickness partitioned by the employee and the year. You can then include this calculation in a condition to exclude all the records where this total is less than a given value.
    Regards,
    Rod

Maybe you are looking for

  • PO split is not working from Shopping cart

    Hi Friends,                  I am using SRM 7.0 service pack : 9.0 . Extended classic scenario . I createad shopping cart with two line items as given below. 1st line :    supplier1      2 nd line : supplier2 . My requirement is: SC has to split into

  • Dual Case Column names fail in select ORDER BY clause

    This one is solved, but I thought someone might be able to explain why it happens. I'm a newbie, since I just downloaded Oracel XE last night, and am trying it out. I set up a trivial table with 4 text columns. As it happened, I used dual case for so

  • Row to column - no pivot

    Hi all, I have data in this format: USER_ID | TOP10_1 | TOP10_2 | TOP10_3 | ... | TOP10_10 USER1 | 1 | 2 | 3 | ... | 10 USER2 | 4 | 5 | 10 | ... | 1 USER3 | 3 | 6 |1 | ... | 2 I need to have this view USER_ID | USER1 | USER2 | USER3 TOP10_1 | 1 | 4 |

  • Games for the Tablet

    I have been using the Playbook Tablet for about 7 months now. The overall usage is mostly for presentations, movies, music, email and overall entertainment. I rely heavily on gaming. Frankly, apart from a few games (20 to be exact), the app store is

  • Calls won't automatically disconnect and resume music playback

    Yesterday I made a call while listening to the iPod and the music faded out to take the call. At the end of the conversation the person on the other of the line hung up, but my phone didn't disconnect for about a minute of inactivity, before it final