Defining sort order using parameter fields

Post Author: vandersee
CA Forum: General
I've created a report, the contents of which is sorted depending on a parameter selected (method used is as described in the help topic entitled "Defining sort order using parameter fields".  Is it possible to vary the Sort Direction (ascending/descending) using parameters also, so that if I choose to sort by field A it will be ascending, but descending if I choose to sort by field B?

Post Author: V361
CA Forum: General
You can create a Parameter {?Sort Order}  make it a string, and add items A to Z and Z to A and a formula and sort the group using the formula.
Group Expert, select the group, select options, check use a formula as group sort order
if {?Sort Order} = "A to Z" then crAscendingOrder else crDescendingOrder
And your group will sort based on what is selected in the parameter.

Similar Messages

  • MDO select query: how to control sort order using parameter

    Hi experts, is there a way of controling the sort order of an MDO select query using some parameter?
    I was thinking about using some statement like CASE [Param.1] WHEN 'abc' THEN [ORDER_NO]...END in sort section of the query but it is not working.
    Of course I colud go for various select queries...but I am wondering if it can be done using only one?
    Any ideas?
    Thanks for any help

    Hi Marco,
    Yes this can be achieved dynamically using SortExpr under dynamic link assignment in MDOAction block if you are using a transaction to call it.
    Please check below thread:
    Re: MDO Query Action Block In MII Transaction
    Or else, this [Param.1] thing should work as well provided it doesn't get the logic part in it, just pass the columns names separated by comma. Haven't tried it though, will check it for you.
    Best Regards,
    Swaroop

  • Define sort order in searchhelp...

    I have remade the premk searchhelp and I was wondering If I could influence the sort order of the fields displayed.
    it sorts by default on the first field in the output list but I also want to sort it on a second column.
    I can't find in the selopt tables in function HRMC_PREM_EXIT where the sort order is defined or whether it's sap standard to only sort on the first field ? can I influence the sort order in the view perhaps ?
    kind regards
    arthur de smidt
    Edited by: A. de Smidt on Jul 28, 2008 10:44 AM

    Hello Arthur De Smidt,
    In the PARAMETER_SORT variable, take the field names
    Eg.:
    If you want a table to be sorted by carrid and connid,
    data:
      w_sort(20) type c value 'CARRID CONNID'.
    Now pass w_sort to the parameter  PARAMETER_SORT in the FM.
    Dont call the FM twice. Use a character work variable which has the field names separated by space and pass that work variable to the FM.
    Hope it helps you.
    Get back for further help.
    Regards
    Indu.

  • Defining sort criteria using vb6 and CR XI

    using vb6 and cr XI and I am trying to provide the user with the capability of defining sort options using options defined on a VB6 form.  The sample code I've found as described below doesn't seem to allow me to change the sort criteria by field name
    'General Declarations
    Dim CRXDatabaseField As CRAXDRT.DatabaseFieldDefinition
    Private Sub Form_Load()
    Set CRXDatabaseField = CRXReport.Database.Tables.Item(1).Fields.Item(8)
    CRXReport.RecordSortFields.Item(1).Field = CRXDatabaseField
    I would like the user to select an option to sort by say Client and then provide this information to the report like I could with CR 7 as follows
    crReport.SortFields(0) = "+{Horse.Location}"
    Thanks for any help
    Gerry

    Hi Gerry,
    Have a look to  [Sample codes|https://boc.sdn.sap.com/codesamples] and [Dev Library|https://boc.sdn.sap.com/developer/library]
    Hope that helps!!
    Regards,
    Shweta

  • Report using Parameter Field

    Hi,
    I have designed one report using Parameter Field which is Cost Code (string).
    When I run my report, I ask to enter cost code. When I enter cost code 30, I get report for all transaction of cost code 30 and 300.
    How could I avoid this problem.
    Thanks
    Mithani

    Try with this
    {Project_cost.EXPENSES_Code} IN {?Cost Code}
    and also
    Check the query formed after giving the input parameter. Goto Database --> Show Sql Query.

  • Updating Sort Order on a field?

    Hi
    i have a customer table. i am displaying them in sorted
    order. but now i have added 1 field call SortID.
    now when ever if i add a new entry ...i want to sort it and i
    want to assign the sorted it for that.
    ex:
    aaaa > 1
    bbb > 2
    ccc > 3
    if i add aaa1 ..then its sort has to become 2 and goes
    one....
    how to update this...using and update command....
    thx in adv.

    Your method is likely doomed to failure, and you will
    probably end up spending an inordinate amount of resources
    attempting to "re-sort" your data. Like Dan is implying, if you can
    determine what the sort order is from information in the other
    columns of the table, why on earth do you need a SortID column?
    Phil

  • Using parameter fields gives an error in InfoView asking for prompting1.htm

    Hi,
    We have a number of Crystal Reports available to staff online via InfoView. The majority of these reports work fine. However, where the report uses a parameter field and allows the user to select certain criteria an error box appears looking for a html page called prompting1. It is looking for the html page in the CrystalReportViewer folder within the Temp folder. Having looked in the folder there is no such html page. I have created a blank prompting1.html but then the when the report is refreshed, it prompts for prompting2.html. When run using the client software the report runs as it should with no error message.Has anyone else come accross a similar problem?
    Thanks in advance
    Aled

    Moved to BOE Admin forum

  • Default sorting order used by oracle

    Can anyone please let me know whether oracle uses any default sort order or not when executing an sql which does not have any sort order/ order by clause?
    I have a sql query where no sort order is specified.
    Now if I add some more columns in the select clause and execute the same query, the number of records returned are same and also the records are same.
    But the order in which they are displayed is different from the previous query.
    Could anyone please let me know whether oracle uses any default sort order or not when executing an sql which does not have any sort order/ order by clause
    or does it depend on the columns of the table?
    Thanks in advance.

    To answer your direct question "why the order in the previous example differ".
    When you added additional columns to the select list, that changed the query plan generated for the query. This caused Oracle to pick up the rows in a different order. There are a number of reasons this could happen, the new selected columns caused a different index (or no index) to be used for one of the tables in the query, it caused a different table to be be used as the "driving" table (i.e. the first one accessed), it caused a different join method to be used.
    HTH
    John

  • Is it possible to sort document using Description field?

    In a specific folder you can sort documents by "Name", "Size" and "Last modified" fields. does anyone know how to enable the sort by "Description"?
    Thanks,
    Nadia

    I will give you 2 answers since I am not sure exactly how your report runs.
    Lets say your users choose a couple parameters to limit certain columns by in your where clause. In this case, you would want to just create a user parameter, and use that parameter in the where clause.
    select col
    from table
    where job_id = :P_JOB_ID and
    start_date between :P_START_DATE and :P_END_DATEPretty simple. Now here is how I would do it if those are optional parameters, and the user could enter a value, or could leave all blank.
    select col
    from table
    where job_id = nvl(:P_JOB_ID, job_id) and
    start_date between nvl(:P_START_DATE, start_date) and
    nvl(:P_END_DATE, end_date)If its null, it will set the column equal to each other, and will return all the rows (good little trick).
    The other case is if you need a different select/where clause entirely based on what the user sends in. For example, lets say you have 2 entirely different queries based on a certain parameter. Then you'd want to use lexical parameters and an after parameter trigger.
    I think you are looking for the first scenario, so try that and post back if you are looking for something different

  • Insert into table irrespective of sorting order of a field

    Hi All,
    I am not able to insert data in the data base table(YY...) as it is in the internal table.
    I do have data in following order in the internal table :
    I am simply using statement insert (database table) from (wa) in the loop...endloop.
    001   0002  2008  0000494219 001   0000494219          254.02  W4136      Keller & Kalmbach Widex
    001   0002  2008  0000198630 001   0000494219          100.10  W4136      Keller & Kalmbach Widex
    001   0002  2008  0000198418 001   0000494219           39.57  W4136       Keller & Kalmbach Widex
    001   0002  2008  0000198419 001   0000494219           89.93  W4136       Keller & Kalmbach Widex
    but when data is inserted in the table it appears as below:
    Means system is sorting the data in ascending order based on 4th column which is document number.
    001   0002  2008  0000198418 001   0000494219           39.57  W4136       Keller & Kalmbach Widex
    001   0002  2008  0000198419 001   0000494219           89.93  W4136       Keller & Kalmbach Widex 001   0002  2008  0000198630 001   0000494219          100.10  W4136      Keller & Kalmbach Widex 001   0002  2008  0000494219 001   0000494219          254.02  W4136      Keller & Kalmbach Widex
    How can I keep the sequence of data as it is in the internal table when I insert them into data base table.
    Thanks,
    Mark

    Assign one more field (let's say SEQ_NO). In your loop keep on incrementing this field and insert in database.
    You have to add this field as first primary key in your database table also.
    Hence you data will look like
    1 001 0002 2008 0000494219 001 0000494219 254.02 W4136 Keller & Kalmbach Widex
    2 001 0002 2008 0000198630 001 0000494219 100.10 W4136 Keller & Kalmbach Widex
    3 001 0002 2008 0000198418 001 0000494219 39.57 W4136 Keller & Kalmbach Widex
    4 001 0002 2008 0000198419 001 0000494219 89.93 W4136 Keller & Kalmbach Widex
    Regards,
    Mohaiyuddin

  • Customizing the sort order of a field

    Hi,
    I would like to sort the order of a group on values within a field rather than in eg. ascending order
    eg.
    I would like to sort the group by values in the Status field, so if the Status values are 'Open', 'Closed', 'Unresolvable' then I would like to order the data by
    Status: Open
    Status: Unresolveable
    Status: Closed
    How would I do this?
    Thanks

    Yes,
    We can do it
    http://winrichman.blogspot.com/2009/09/custom-dynamic-sort-in-bi-publisher.html
    <?sort:(number(status='Open') * 1) + (number(status='Unresolveable') * 2) + (number(status='Closed') * 3);'ascending';data-type='number'?>Put this after the for-each statement
    do change the status to the element name in you xml.

  • Use Parameter to choose Group and Sort options

    I've got a report that gets used for several different puposes, and needs to be grouped or sorted differently each time.  How can I use a parameter to let the user choose the group and sort options at runtime?
    I'm using CR2008, and SAP B1 2005.  The various grouping options I want to offer include SKU, Vendor and Description, and sorting within those Groups by SKU or Description.
    I'm a newbie with CR, so detailed instructions would be really helpful.

    You can create a report using parameter field. Follow these steps
    -- Create new parameter in the field explorer window
    -- The parameter shouls be static and enter all the field names on which you want to create in the values option
    -- Now create a formula like this
    if {?Parameter}="fieldname1" then
    else
    if {?Parameter}="fieldname2" then
    else
    -- Now insert new group and select this formula
    -- Now the group will change according to the parameter selected
    Please note that if you have different data types of fields you must need to convert totext()
    as If condition will allow only one data type output.
    Also when you insert any group by default the data is sorted on grouped field. If you want to sort on another field then you need to insert a summary field on that and go to report>group sort expert>select the field-->All based on the summary inserted.
    Hope this helps!
    Raghavendra

  • Sort order inconsistent behavior

    There seems to be inconsistent behaviour when defining a default sort order sequence.
    Everything works as expected when the display sequence and the order in which the columns are defined in the query are the same but as soon as the display sequence is changed the default sort order doesn't work for the second column in the order sequence.
    I have put up an example at [apex.com|http://apex.oracle.com/pls/otn/f?p=36885:1]
    In report EMP the display sequence and query sequence are the same and the default sort on "Job" and "Hiredate" is correct working. Even when the user sorts on "Manager".
    The sort order sequence then becomes "Manager", "Job" and "Hiredate". As also descripted in the following Sorting on multiple columns
    And exactly the behaviour we are looking for.
    Report EMP2 is a copy of EMP with the only difference the order in which the columns are displayed
    Now the default sort order doesn't work as expected. The report is first ordered on "Job" but then on "Employee" instate of "Hiredate" as is defined. Interestingly "Employee" is the second column in the query.
    It seems that instate of the query_column_id the column_display_sequence is used in the order by. At least for the second column in the defined sort order sequence.
    This may also explain the behaviour mentioned with [derived columns and sort sequence|http://forums.oracle.com/forums/thread.jspa?messageID=1006429&#1006429]
    The display sequence in report EMP2 is where the wizard came up with.
    Nicolette

    Stew
    At the report attributes you can define the sort sequence of a column. When you do that initialy the report is sorted as you defined it. So in my example that is first by "Job"and within "Job" by "Hiredate". When the user sort explicit on an other column this column is put before the columns you have defined.
    So when the user clicks on "Manager" the sort order becomes "Manager", "Job", "Hiredate". When the user then sort on "Employee" the sort order becomes "Employee", "Job" an "Hiredate".
    This works when the order in which the columns appear in your query are the same as the order in which they are displayed.
    BUT as soon as the display order changes the sort sequence doesn't work anymore. Even worse is that also the initial sort sequence doesn't work for the second column any more. (I haven't tested for three or more columns)
    In the example I have put on apex.com in the second report the sort sequence of the report attributes is the same as in the first report. But the initial sort order that is actually done is on "Job" and "Employee" instate of "Job" and "Hiredate". Where "Hiredate" is the second column in the display sequence. But "Employee" is the second column in the query.
    So to really make use of the sort sequence you have to keep your display sequence equal to the order in witch they appear in the query. This isn't really practical.
    Nicolette

  • Changing items sort order at MI04

    Hi, experts.
    I have a requirement here, which is: I need to change the sort order for MI04´s items: instead of the standard sort order (which considers field ISEG-ZEILI as sorting condition), I´ll have to read another field from MARD and use it as sorting condition.
    I´m already inserting an Enhancement into form RELEVANTE_POSITION, where I read data from MARD, create an auxiliar internal table similar to LISEG + my sorting condition field, and re-sort LISEG according to my aux int. table.
    As I know that I shall have some extra work handling all the problems that those modifications may cause on futher execution of MI04, I would like to know if there is an alternative to this approach.
    So, I ask you: have you ever had to do something like that?
    Thanks,
    Mauricio Dotto
    Edited by: Mauricio Araujo Dotto on Dec 7, 2011 3:30 PM

    There's a more detailed thread covering this at Mac Mail re-sort loses selected eMail
    tl;dr: Working as intended. My workaround is to use the arrow key to move to an adjacent message. This refocuses the window.

  • IPhoto album slideshow will not play in the manually sorted order.

    iPhoto Album slideshow will not play in the manually sorted order.

    Use a regular slideshow created by "File > New Slideshow".  These will play manually sorted. The instant slideshows cannot be played in a manual sort order.

Maybe you are looking for