I am trying to show the highest values in column B which is related to each uniqe reference.I've tried this formula but didn't work.
The Data
Output 01.03.2019
This is out put from the below formula
Blockquote
01.03.2019_1
Blockquote
enter[01.03.2019_2]5 image description here
Expected Output
whileprintingrecords;
stringvar dept;
if {baseevent1.Column B} = Maximum({baseevent1.Column B},{baseevent1.Referance}) then
dept:={baseevent1.Referance}
There is an easier way to achieve your goal with less formula usage and more grouping and sorting.
You will need 2 grouping levels. The top-most group will be Referance, and then below that group on Column B. Ensure that Column B is sorted from lowest to highest. By sorting this way, the very last detail record will always contain the highest value of Column B.
Then suppress both group header section, suppress the details section, and suppress the Column B group footer section.
Place data fields for Referance, Column B, and Formula in the Referance Group Footer Section.
By grouping and sorting in this manner, when you reach the footer section for your top most grouping, the values each field contains will always be the record that had the maximum value of Column B.
No need for any formula fields at all with this approach. :)
Just do be aware, that if you ever have a duplicate value in Column B within a Referance Group, then you are going to run into issues, as this approach will print only the values of the last record in the grouped data. However, even with a formulaic approach like you began with, you were still going to run into this issue should there be any duplicates in the composite key value created by concatenating Referance and Column B.
What I would like to do is either suppress a group or (if possible) write this in to a selection record.
The goal would be to display all records in the group if any one of the records in the group meet the requirements.
For example if my group has three records and my requirement is that one of the records have a specific value in one field. Then display all three records in that group. Otherwise, if none of the three have that value then suppress the group.
I know where I need to put the formula and I thought the following would work but instead it only gave me the records that met the requirement not the others that accompany it.
Placed in the suppress group formula field:
if {table.field} <> "1" then true else false
Any thoughts on this?
Looks like I got it figured out. Here's what I did:
Create a Formula Field to check if the value exists in the record as follows:
if {table.field} = "X" then 1
Create a Summary Field of the formula field just created and sum the total for the formula field effectively counting how many records in that group have the value sought after.
Go to Section Expert for the desired group and Suppress using the following formula.
if Sum ({#Formula}, {table.field_2}) < 1 then true
i want to filter my rows and only select/ display my rows when the field AMSD135.AB is the latest date date in that group.
So i got a report with some groups where the last group is grouped on AMSD135.AB. Now i created a formula to hide the section.
AMSD135.AB <> Maximum({AMSD135.AB}, {AMSD135.AB})
but i always get the following error message:
There must be a group that matches this field.
if i use
AMSD135.AB <> Maximum({AMSD135.AB})
it searches for the max in all rows.
It works when i use the following formula:
{AMSD135.AB} <> Maximum({AMSD135.AB},{Arbeitsgang.AGNR})
with {Arbeitsgang.AGN} being the group above. Which makes more sense, since when i group by AB, Max(AB) is always AB. But shouldnt it still work.
I'm trying to modify a report created in Crystal Reports 7 (which I know almost nothing about). I want to use a CrossTab, as this seems to be the best way to accomplish what I want. I have a column with three possible values: A, B, C. The cross tab creates three columns. I want to suppress C. How can I do this?
Also, is there anyway to create rows based on one field (i.e. a PK value), but display another - like a description? For example, if a list of states have a PK value of 1-50, I want them ordered by PK, but I want to display the state name.
All you ask is possible;
i suggest not to use cross tab: cross tab is intended for an uknown number of rows and columns (varying on data) ad for summarizing (max value, sum of values) results on a grid.
you should, instead:
Create a blank report
Drop the fields from the Field explrorer into the Details Section (just A and B columns)
Use Report Sort Expert to sort elements no the PK value
Ok, this might be a weird request, but is it possible to essentially flatten my dataset inside a crystal report?
I have a datatable in C# that was created with a join, so when it hits the report its 2 records. Most of the columns have identical data, with the last few displaying a different address.
Instead of printing the detail section multiple times with mostly similar data, I need to display 1 'record' with the common data printed once, and each records address arranged next it. As in, all the common fields displayed in one area, and then next to that the address fields from the record where 'AddressType = 1', then next to that the address fields where 'AddressType = 2'
Is this a subreport thing? Because even with subreports I can't get it to only print 1 detail section with the data from just the first record.
Is this even possible with crystal? For long drawn out reasons, I can't flatten the data before it gets to the report.
Ok, someone here in the office showed me the way, so I'll put this out there.
Given data with cols A,B,C all common and D,E different across multiple rows, this is how I 'flattened' the dataset in crystal:
Create a group based on col A, and put A,B,C inside that group header - get rid of the details section entirely
Create a subreport in the group header for each row of data, in my case 2 subreports
Inside each subreport, put fields D,E. Important: There are NO links for these subreports!
For each subreport go into the Select Expert and create a condition that shows only 1 particular row of data. This conditional will have the same field for each subreport, but different values. In my case it was AddressType='A', and AddressType='B'
This will produce 1 report, with A,B,C listed once, and D,E listed once for each subreport(once for each row of data)
This was confusing, time consuming, and I hate crystal reports now more than ever.
It would be pretty ugly, but you could add a group for each common field in Group Expert and then display the data for the common fields in the last group header. So if your common fields are field1 through field5, you would create five groups and put all five fields in the group header of field5. Then you would put the unique address fields (call them field field6 through field8) in the details section.
Now the trick is getting everything to line up correctly. You can set "underlay following sections" on the group header for field5; this will cause field1 through field5 to "fall down" into the details section. You just need to make sure that field6 through field8 are all to the right of field1 through field5 so the text does not overlap.
Now, if you want the two address records to print horizontally, I think you will need a subreport with multiple columns for that. But the same principle applies -- just make sure the subreport is to the right of field1 through field5 so the data doesn't overlap.
Have you tried the suppress if duplicated option on each non-address field?
Otherwise, you could group by the common id, put the common fields in that header, and then display the multiple addresses in the details section.
Or, you could remove the addresses from the datasource and use a subreport to fetch this data for each record. This would bypass the join and be the slowest option performance wise, due to having to select the addresses for each record.
Ok, firstly let's see if I understand this right :
You want a report that would be in the format
MainDetails Address(type1)
MainDetails Address(type2)
to instead be in the format
MainDetails Address(type1) Address(type2)
?
Assuming there are only two address types, you can do the following :
1) Group by Main details (whatever the unique entry is
2) Put the address details in the group header next to them, on the right
3) Also put the address details in the details section, but positioned as if they were in the Address(type2) column positions, so it looks like :
GH MainDetails Address
D.......................................Address
4) Next, add a sort to the report on the AddressType field, so that AddressType=1 shows first.
5) Add a conditional suppression formula to the Details section saying {AddressType=1}
6) Using the Section Expert, in the Group Header tick the 'underlay following sections' box
This should work as long as the number of addresses is either 1 or 2.