RDLC sorting on multiple columns - visual-studio

I want to sort an rdlc report by two or more columns.
This could happen if I have two names that are the same so then it should next be sorted by ID column.
When I navigate to textbox properties and click the interactive sort tab I can only select one column to sort by.
How to add more than one column?
EDIT: I just realised you can edit the matrix of the entire table to add multiple sort fields. I'm guessing you can also create a group and attach that to the column if needed.

I also did not find multiple columns fields for interactive sorting.
You can workaround this by specifying an expression where you concatenate columns values. Note that date field you have to format in a sort friendly way.
=Fields!MyString.Value & CDate(Fields!MyDate.Value).ToString("yyyyMMdd")

yes, you can add multiple sort fields in the tablix properties.
Aside from that, if you click on a row textbox, you can see the Interactive Sorting tab, where you can group and sort field values.
Hope this helps!

Related

Is there a way in SSRS to highlight an interactively sorted column

I have a report with several interactive sort columns for sorting/ranking various metrics. I would like to highlight the column or even just the column header that is sorted. Is there a property that will tell me which column the report is sorted on?
I have not been able to find any threads that address this question.
No - there are no properties in SSRS to let the code know that the column is being sorted.
If you wanted to put in the effort, you could add a parameter with column names for the sorting. Then just set the table or Groups SORTING by your parameter using a Switch statement and the background color of the header and/or data cell(s) using an IIF for each column for the color.
SORT EXPRESSION:
=SWITCH(Parameters!SORTING.Value = "NAME", Fields!NAME.Value,
Parameters!SORTING.Value = "AGE", Fields!AGE.Value)
Background Color Expression for a NAME column:
=IIF(Parameters!SORTING.Value = "NAME", "Whitesmoke", "White")
For the other columns, just use the column name.
To be a little slicker, you could use the ACTION on the column header for each field to set the parameter and recall the report rather than forcing the user to hit View Report. You would Specify the same report but Add the SORTING parameter and hard code the columns name (which has to be the same as the SWITCH function).
Unfortunately, this would require the report to rerun each time the user wanted to sort.
Kinda lame but it's the only way that I can think of to do it.

SSRS Sorting a data in a column in Tablix SSRS

I Need to Sort the data in column/columns in Tablix(SSRS2016). The Sorting is working when I am opening only that table.rds . When i am executing the whole Project and opening that subreport it gives a error.
"one or more Parameters were not specified for the subreport, 'subreportname', located at: /__rdlname"
I don't understand why I Need a Parameter when I Need just to sort the data in column.
Can somebody help me ?
I did a right click on column Header -> TextBox properties -> Interactive Sorting
Enable interactive sorting on this text box
As I want to sort with the Groups
Choose what to sort:
I have Chosen Groups.
Then Sort by Field which was in drop down list.
in the end
OK.

MS Access table list order is defaulted in subform

I have a subform with a table, where some fields are restricted to tables. The tables are sorted in the correct order, but when it is used in the subform, it is set to default sorting. I can't find the location of the correct place to set the sorting criteria. I tried using query instead of a table, but i could only sort either by ascending or descending (or nothing). All three options resultet in undesired order. Example of the phase being sorted as default despite the table settings:
Suggestions?
As Gustav suggests, add another field to your t_Phase table, which will be the order you want this list to appear in the drop-down (make sure it is a number field):
Supply the numeric order:
In your other table, you can use the ID field from your t_Phase table by selecting it through the lookup wizard:
Move across the ID and the new "Order" field you just created:
Use the "Order" field as the field you want to use for sorting and make sure "Ascending" is selected:
Continue through the wizard:
Select the field that has the data you want to go in to the record of your table (I assume it's the ID field rather than the Order field, so make sure ID is selected):
Finish the lookup wizard and go in to Datasheet View on your table and check that the dropdown is now in numeric order. You've probably noticed a problem though as it is showing both the ID and the Order columns:
To hide the unnecessary Order column, go back in to Design View and click on your phase field to select it.
At the bottom should be a "Lookup" tab. Click on this and notice the Column Widths property... it's showing 2 different widths values; the first one is the ID field and the second one is the Order field. Set the Order field to 0cm to hide it. I'd then recommend setting the remaining Id field width to something that will be wide enough to show all your ID field's options. Then I'd set the List Width property to the same width.
8cm, for example:
This should result in something like the following, which is hopefully what you're after.
If you're not adding a lookup field to the design structure of a table, but are instead using a combo-box on a form or subform, the principle is pretty much the same; you'll just have to amend the combo-box properties from the form's Property Sheet "Format" tab instead:
Combo- and listboxes always contain text, thus your column is not sorted numeric.
To have a numeric sort, add a column with the number only and - in the source - sort only on that. If you don't the number separately, create it from this expression:
Val(Mid([PhaseField], 7))

Sorting the values in a listbox when using an expression in the sort tab in Qlikview

I want to know if anyone knows how to sort the values in a listbox in Qlikview, when one is forced to have an expression in the sort tab?
I had to use the same expression from the general tab in the sort tab
if(datakilde='Aarlig', Aktivitetsnavn)
Otherwise the listbox didn't show the associated values (from a selected value from another listbox) in the top of the listbox - which aren't very user friendly.
But as a consequence the sorting in alphabetic order is no longer works...
(And I had to have an expression in the general tab, becausecI only need a subset of the loaded data).
(I also tried with the option auto ascending in the state box under the sort tab).
See my sort tab below.
Kind Regards Maria
There are multiple solutions on this, but I think the correct one, would be to create a field in your datamodel, that contains just the values that need in the listbox.
Listboxes are not very good at filtering data. So take your if statement, and put it into the source table:
if(datakilde='Aarlig', Aktivitetsnavn) as Aktivitetsnavn_2
Then you don't have to struggle with filtering data in listboxes and your sorting will be correct.
i had similar problem while sorting a listbox with values filtered by an expression. I gave up on filtering in listbox and filtered in my load script. After that i was able to sort properly.
A solution for a similar situation I just had was the following:
I've loaded all Items that i needed sorted & filtered out in a separate table, for example:
zones:
LOAD * INLINE [
zone, **zone_order**
zone A, 1
zone D, 2
zone C, 3
zone B, 4
];
I've added my zone in the filter and in the Sort tab, i've chosen to sort by expression: zone_order, and that's it!

Use an Aggregate function in Sort Expression

I have a report which uses a dataset returned from a stored procedure. There are two key columns: Name and Value
I am using this dataset for two tablixes. The first is just a straightforward tablix displaying the data.
The second groups the data based on a Name column. I need to order this data based on the Sum of Value column
However I get the following error:
[rsAggregateInDataRowSortExpression] A
sort expression for the tablix
'table1' includes an aggregate
function. Aggregate functions cannot
be used in data row sort expressions.
Is there another way I can show the data grouped by name and still order it by Sum(Value)?
Instead of sorting on the tablix you need to sort against the row group. Remove the sort on the tablix and then go to the row group properties and put the same sort expression under the sorting section there, this should then work.
OK, I just had to add an extra column for the the Sum value to my query and then use that. Not ideal, but it works

Resources