SSRS - Sort table based on column value - sorting

I am trying to sort the following table:
hYear hSale
------------------------------------
[year] =Count(Fields!sale.Value)
The table only has one row group (year) and no column group.
I'd like to:
-initially sort the table based on the calculated value; is it possible?
-add interactive sort to calculated column based on the value. I assume I should sort 'Detail rows', but what will be the sort expression?

Yes on both:
Click on the table or grid to make little gray boxes appear. Click in the upper left corner and select properties. Select Sorting. Hit the 'Fx' button. Put in your expression you have above.
For dynamic sorting select the cell in a table (not the header) and click 'Text Box Properties. Select 'Interactive Sorting' and select 'Enable interactive sorting on this text box'. Put in your dataset column or else a custom expression like what you did above.

Related

SSRS Dynamically Show Data

I am wondering if you can have other tables show based on the value selected in the main table. I am not opposed to drill-down either.
My main table is the summary and was hoping to show additional data when the user clicks on a Type. When clicked another table would be visible. For example, in the screenshot, the Pool table would be visible when the Pool type is clicked in the main report. As mentioned if this is easier as a drill-down then I will do that, but not sure how. The report currently has a dataset for each table. Do I need to combine the datasets to do a drill-down?
Main and child tables
The best way to accomplish what you described is with a drill down and you would need to combine the datasets into one.
Combine your datasets
Add a table to your report and reference the single dataset
Add your detail row group to the table - from your child table (Area, Average)
Add a parent group to your details row, group your detail row group by Type, it should add a Type column to your table. Delete this column and it will ask you to delete the associated group as well. Select the option to delete only the column.
Recreate your table by adding rows, be sure to match the grouping indicators (brackets) on the left side
Right-Click on the bottom row in the box where the bracket is to highlight the entire row, click Row Visibility. For the option "when the report is initially run:", select Hide. Check "Display can be toggled by this report item" and select the name of the textbox that contains [Type]. If you don't know what this is, exit out of the dialogue box and right-click on the cell [Type] and click Textbox properties, the Name will be in there
Repeat step 6 for the label row for your details row (second row from the bottom)

Oracle Apex 5.1: Report column based on LOV(List of values) showing returned value not display value

I have created an interactive report with a form. In the form I have two select lists. The first select list is a list of values defined in the shared component. And the second select list is another list of values which is also defined in the shared component but this select list populates its LOV based on the selected item in the first select list.
Let the names of the select lists are:
Region.
Country(which is dependent on the selected item in Region field).
Now when I press save/create button in the form, a row is created in the report. The Region column and Country column in the report are both "Plain Text(based on List of Values)". But what I see is the Region column is showing the correct display value of the LOV but the Country column is showing the returned value of the LOV.
I want both of these columns show the display values rather than the returned value. Could anyone help me find the solution?
Are you using the same LOVs in form and interactive report? If so and in the conditional LOV (countries) you refer your form item (ex. PX_REGION) it will not work correctly in IR. Probably IR is showing the returned value because the option "show extra values" is checked.
If this is the case my suggestion is to change your IR and instead of a "Plain Text(based on List of Values)" you make it plain text and change the query to an inline query in IR query to obtain the value you want to show.
If you don't want/like to put your LOV queries in different places I suggest you to use this approach shared by Nick Buytaert
Hope this helps you solve your problem.

Dynamic cell via parameter

I am trying to find how to do the following. I need to fill a string (a word) in a column that I can change from a table. Static way: Add Column > In formula ="FORD" So it fills all existing rows in the columns Variable way: If I change to HONDA the cell at the table, use  the new word in the query Thanks!
Something like https://stackoverflow.com/a/31522846/771768 will work:
Click on the Excel cell with HONDA, then open menu Power Query > Excel
Data > From Table (uncheck "My table has headers")
In the Power Query editor, right click on the HONDA cell of the table
and "drill down" to get the text value, and change your add column step to use this Column1
You can edit the value in sheet 1, and when you refresh your query
you'll see sheet 2 is changed.

SSRS sort icon not showing up in header but showing up in column values

I am very new to SSRS. Infact this is my 2nd report.So in SSRS, I went to Interactive Sorting and checked the "Enable interactive sort on this text box". Chose the first radio button "Detail rows".For sort by I chose "ColumnName" and clicked ok. I ended up with a sort icon on every value .The data here may seem duplicate but it is correct. I have additional 6 columns apart from this "Product" column. I repeated the sort action for all columns same way, the only difference being the different "Sort by" column. I get the icon on all columns in all rows. I want it on the header only.
Apart from that I get this warning 6 times :[rsIneffectiveSortExpressionScope] The text box ‘ColumnName’ is defined at the scope “Details”, which is identical to the scope used as SortExpressionScope. This interactive sort has no effect at runtime, since it sorts only the particular instance itself.
What is that i am doing wrong ?and what should i do to correct it?
Rt click on the textbox with the Column Name, click on
Interactive Sorting
then Check
Enable Interactive Sorting on this textbox
and then select the appropriate group you want to sort.
AFTER EDIT
if you dont have any groups yet, just select Details Row. If you have/create any group, then you need to select the radio button Group.
The sort by will actually have the column you want to sort with.

Crosstab column group sorting

I am trying to sort the column group in crosstab but iReport is applying its own sorting by name ascending. I tried inserting "Order By Exp.", but it didn't work. (Field not found error!)
What is the correct way to add our own sorting by field/variable? Or I have presorted data, viewing it as it is will do.
I had a similar problem. I wanted to display a "Heading" from the database, but I did not want it to sort alphabetically since the order of the headings were user determined.
I had a HeadingOrder field that I wanted to sort by. To use it in the sort expression it has to be in the cross tab.
I had heading in my column so made 2 column groups: 1) HeadingOrder 2) Heading.
I removed the text field that displayed the heading order number and collapsed that area so it did not display. This allowed the cross tab to display the Heading while using the HearingOrder field as the dominate sort.
WORKAROUND:
Concatenate the field (to be used in the Column-Group) with the sort by field in the sql query itself. suppose field name is "title" and sort field name is "rank", then
select (mt.rank ||'-'|| mt.title) as title from my_tab mt
(Above query specific to postgresql)
Use this "title" field in corsstab column-group as usual.
Click on text field of "title" column group on crosstab.
Edit its "Text Field Expression" from properties panel as $V{title}.split("/")[1]
Right click the crosstab in ReportInspector-->click on crosstab data
a new window would open.
Now click on Data is pre-sorted. this will do the work
user1120946, for me what did the trick was to disable the total of the subgroup (e.g. Heading), and enable only the total of the overgroup (e.g. HeadingOrder). Then just put the measures in the HeadingOrderTotal column.
That is meant as a comment on the second answer.
this is a duplicate of Crosstab Sorting in JasperReports and the referenced "rather clean although tricky solution" based on hidden group(s) works quite well

Resources