Sorting Data with Sort Expressions

  • Hi,

    I would like to sort data in the report after it is retrieved from the data source. I'd like to set sort expressions on a Tablix data group. For example, to sort on the field [Transactions] in the order below. Need expressions example to use in the sort properties.

    Transactions

    -----------------------------

    Express KOA In State Move In

    Express KOA In State Move Out

    Express Out of State

    Manual KOA In State Move Out

    Manual KOA In State Move In

    Manual Out of State

    Thanks in advance for any help.

    -Baaul

  • Use

    Properties ? Sorting ? Expression (Fields!Transaction.Value) ? Direction (Ascending)

    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    Please feel free to let me know if you are not clear or I’ve misunderstood anything.

    Thanks,
    Arunkumar S P

  • Actually, it's not in order ASC. I'd like it to be in the order below...AScending won't work.

    Transactions

    -----------------------------

    Express KOA In State Move In

    Manual KOA In State Move Out

    Express KOA In State Move Out

    Manual KOA In State Move In

    Express Out of State

    Manual Out of State

  • Its better to keep the seperate column (SortOrder) in your table for sorting. and assign the values in table like below

    Transactions SortOrder

    ----------------------------- -----------------------------

    Express KOA In State Move In 1

    Manual KOA In State Move Out 2

    Express KOA In State Move Out 3

    Manual KOA In State Move In 4

    Express Out of State 5

    Manual Out of State 6

    Now sort the table based on Fields!SortOrder.Value

    Properties ? Sorting ? Expression (Fields!SortOrder.Value) ? Direction (Ascending)

    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    Please feel free to let me know if you are not clear or I’ve misunderstood anything.

    Thanks,
    Arunkumar S P

  • RAQ Report is a good choice. It's a free java reporting tool. It can sort Data easily. As shown below:

    You can download free RAQ Report at http://www.raqsoft.com[/url].

    Welcome to my blog[/url].:P

  • If you dont want to change the query or dont want to add the fields..

    and if your results are constant with the names..

    then try the following in the SORT expression: and sort order is AtoZ

    =SWITCH( Fields!Transactions.Value= "Express KOA In State Move In", 1,

    Fields!Transactions.Value= "Manual KOA In State Move Out",2,

    Fields!Transactions.Value= "Express KOA In State Move Out",3,

    Fields!Transactions.Value= "Manual KOA In State Move In",4,

    Fields!Transactions.Value= "Express Out of State",5,

    Fields!Transactions.Value= "Manual Out of State",6 )

  • Thanks ! This is what I wanted. I wanted the sorting done with report side expressions. This will do the trick

    -baaul

  • Did that work for you? I need to sort AtoZ then blanks at the end, but

    I cant get this to work:

    =SWITCH(Fields!ALF.Value = " ", 2,Fields!ALF.Value like "%",1,)

  • Try adding this sort expression.

    =IIF(IsNothing(Fields!ALF.Value),"ZZZZZZ", Fields!ALF.Value) Sort order AtoZ

  • That is what I did in the Crystal report equivalent, but it didnt work here. It says the expression is invalid. I also tried this: =Switch(IsNothing(Fields!ALF.Value),"ZZZZZZ", Fields!ALF.Value) but it returned nothing.

  • Use the IIF instead of Switch

  • Thank you! This worked, the field was really a space.

    =IIF(Fields!ALF.Value = " ","ZZZZZZ", Fields!ALF.Value)

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply