How can I change the order of values in a stacked bar chart in Cystal Reports? - crystal-reports

I have a stacked bar chart in Crystal Reports which is used to display the number of employees in each process area that still require training.
Crystal automatically sorts fields in each bar on the bar chart alphabetically, this would normally be fine but I want to rearrange the order in which the areas appear so that they coincide with the production sequence.
I thought that I would be able to rearrange the order by going to Chart Expert>> Data>>Order and clicking on Specified Order. But this doesn't appear to be working so I must be doing something wrong.
Does anyone have any advice?
Any help is greatly appreciated.

I'm assuming the chart risers (= the bars) are coming from a grouping level you've specified in Group Expert and selected in Chart Expert.
Here's what to do:
In Group Expert, insert a second group. Leave the original group unmodified so you don't inadvertently affect the chart.
Set the new group to group by your sort key – the field that specifies the desired order of the bars.
Move the new group up in the group list – so it precedes the original group.
Suppress the new group's headers and footers.
Now Crystal will first sort your records by the sort key, and then by the field you're currently using. You should get the same risers in a different order.
Note: If the records for a given bar have differing values for the sort key, this won't work. If that's the case, you'll need a summary field and Group Sort Expert instead.

I just encountered this problem. My solution was as follows:
In the "Chart Expert" Select the field in the "On Change of" block
Click the TopN button
"For this group sort" to "All"
"based on" the field you want to sort by.
This will keep your bars labeled as their original category, but instead of writing in alphabetical order they will sort by the field you choose.

Related

How to filter records in a single section of Crystal Reports

I have my base record set filtered with a parameter. However, this leaves me with 6 records and I need to filter down to one particular record in each of my sections. If none of the records meet my criteria i cannot suppress the section, it will need to just stay there and blank.
Essentially, I need a method to filter down records that hit one of my sections but not affect the report as a whole.
A few notes:
I cannot use a subreport for this. I need to duplicate this effort over a couple of sections and if I add any more sub reports it just crashes crystal reports (I have a lot of data & a ticket with SAP)
Using a suppression formula hasn't worked yet because I need the section to exist, if it has a null value
Applying no filter doesn't help me because it will duplicate my section 6 times
2 options.
a)
Right Click on white space and choose Insert Group
Choose your field and select specified order or use another record that can filter your data
On the Specified Order Tab click New
Select equal to on the combo box and specified what record you need to be shown
or
b)
Right click on the record
Next to the suppress check box, click on x-2
Here you can create a formula to suppress the records that you don't need.

Crystal report Cross-Tab order by another column

I've made a crosstab in crystal report like below:
However, as you can see, the ordering is weirld (i.e. the correct one should be like below:)
And the ordering is stored in another field called order, I took a look in the crystal report's cross-tab expert sorting option, it doesn't allow me to order by another column, it only allows me to sort either ascending or descending, how can I set the ordering by another column?
Crosstab's sorting is based on the rows order, if you want to sort it in your on you have to add some extra rows and have to suppress subtotal and Label in Customize Style of Crosstab Expert
Example:
If you have 3 rows(A,B,C) to display and you have to sort it in order like B,C,A then you have to add 2 new rows(B,C) now your Crosstab looks like (B,C,A,B,C) now you have to suppress Rows B and C you meet your both requirements for sorting and display order
But This solution have some limitations like
if you want to export the report in Excel then it will add extra cells in grand total.
otherwise you are good to go.
Example:
If you have 3 rows(A,B,C) to display and you added one row and you suppress it to solve your sorting issue then in Excel its grand total looks like
A B C
a 1 3
b 2 2
---------------------------
Total: 3 5
Yes, you can not sort on another column. You must use any of one column as a header.
In Crystal report, sorting happened based on header column's value (That's why you see as per alphabetic).
I also face this issue and how I solved, that I am explain. You have to use a formula which have order, but either hide it or use a value like in this link.
https://scn.sap.com/thread/3341846
Second option as per this link. (I think first you check this)
http://www.codeproject.com/Tips/493334/Custom-sorting-for-Crystal-Report-Cross-Tab
https://scn.sap.com/thread/1172741
open crosstab expert, highlight the column that you want to reorder, go to Group Options and select in specified order. This will open another tab where you will have your available values listed there. Using the arrows on the right side you can move up or down your values and accommodate them in the order you want them to be displayed.
Simple way would be take order column from stored procedure to cross tab and set the order according to that column.
Then supress the order column and reduce the width of that column to minimum pixel so that it doesn't appear in cross tab.
Make the field you want to sort by a group field and hide it. To hide it, in the Crosstab Expert > Customize Style dialog select this group then use the Group Options area to Suppress Subtotal and Supress Label. Worked for me.
Use the order field as the grouping column and change the label for said column to show the actual sizes. The labels can be changed in Crosstab Expert, Grouping Options and then the tab Options.

Crystal Report how to change the display order in a group

I have a crystal report like below image:
The report is group by "Quot No.", by default it's ordered by "Times Used" (8th column)
How can I change the ordering so that it will order by "Total amount"?
The total amount is a field in the report which is the sum of a field named "quotamt" in the datasource:
I've tried looking in the change group options, took a look at the "Use a formula as group sort order", but the formula only provides three options (ascending, descending, original order), and is unable to sort by another column
The desired result is:
How can I do that?
What I suggest, rather than doing this task in crystal report, good to done at sqlserver side means database side.
This is simplest suggestion when you have this type of situation.
You can give the condition on sqlserver side too. and get the data order same as you want.
Yes, this can be done in report side, but it take time for this.
Don't use formula as group sort order instead from the dropdown use Specifed Order and in the window specify the order you need

Custom Sort in Crystal Reports

We have a report that has one group. The group header is based on a (rather extensive) formula which says if the item number is equal to "AAAAAA" then the header should read one of the following:
Conduit
Metal Flex
Copper Wire
Aluminum Wire
Aluminum SE
SO Cord
SQ D
Breakers
etc.
Currently, the groups are sorted in alphabetical order when the report is run. How can we change this so it prints in the order we want (for example as above)?
On the "Use a Formula as Group Sort Order" formula, it says we can only return the group sort order constants as Ascending, Descending or Original order. I tried Original Order seeing as how the group formula is set up in the order wanted, but it still does it in alpha order.
If you are using the field from database to group then you can use option "Group in Specified order" and there provide the order you want to view.
You can get the option if you go to change group.

How to suppress specific bar on bar graph in crystal reports?

So I am trying to suppress a specific bar on my bar graph. So instead of populating the graph from the database, I am populating it from a formula field. So in my formula field, I have something like this:
if field <> "Member" then
formula = field
So it gets rid of the field however it leaves me with this:
I know I can make a subreport that gets rid of that field from the beginning, but I was hoping to avoid creating a subreport for this.
Any ideas? Thanks!!
Instead of leaving the group name as blank when the field is "Member", I suggest changing it to be the same as another group which you can always expect to appear on the report - perhaps "SR not handled timely".
This would lump in all the member values with the other group's values, so if you haven't already done so, I suggest graphing the value of a derived field which is set to 0 for "Member". (I suspect you have already done this, as the blank group is showing a value of 0.)
The least error-prone method is probably the subreport. If this report is very dynamic, and you always want to hide group A in the graph regardless of it's value, then this is the best way to go.
If a static number of groups will be appearing in your graph, you can limit to display the top N groups. i.e. If there are 7 groups total, and you only want to hide 1 of them (which always has a value of 0), then you can display the Top 6 groups (picture is of Crystal XI):
Thanks for all the help guys, the data will be pretty dynamic.. So I am going to go with the subreport. I will add those little tricks to my toolbox though! Thanks again.
Alternatively, you can set a "specific order" and only include the values you want to include in your graph. In the "Other" tab you need to select "Discard all others".