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
Related
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.
I have a view panel displaying a categorized view, all my columns are sortable.
When I click to sort one of the not categorized columns the values in categorized columns are not displayed. this is normal behaviour for a sorted categorized view in IBMNotes client as well.
The problem is that I need the category values to display if the view is sorted (clicked on sort icon) or display another column containing the category values, but only if the view is sorted.
How can I accomplish this?
First option: use more views with different sort setting in columns after category column. Dynamically change the view name. This works as you want, but it has performance impact on server and I don't recommend it.
Second option: use hide when on redundant (flat) column based on sort options. Exact formula depends on your implementation (submit page code).
my problem is maybe simple but i don't get it.
i have this Crosstab :
So my idea is to hide all rows where ALL data fields ("Wert_Bezeichnung") are empty. But this is not possible easy if i get it right, because the birt renderer thinks the rows are never be empty because the left two columns ("Position" and "Bezeichnung") are never be empty. that are the row names.
Is it possible to hide the rows without touching the java code behind?
thanks in advance
As you describe the issue, it seems these empty rows are generated by the dataset itself. Double-check if property "Show empty rows" of this crosstab is unchecked.
Anyway, you should just have to add a dataset filter with an expression excluding empty rows.
Edit the main dataset of your datacube
In "Filters" tab, add a new condition
select field "Wert_Bezeichnung" and operator "Is not null"
If it doesn't work, it means these rows are loaded with something different than a null value, for example an empty string. You need to adjust the dataset filter accordingly.
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.
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.