Crystal Reports Select only Unique ID - crystal-reports

I have a report that is pulling an ID field. I want to use the select expert to say if an ID is duplicated, do not pull this data. I know I can use format field, suppress if duplicated, but I don't want the data to be pulled in the first place, if possible.
How would I do this?
Thanks.

Please check below listed solutions. I usually try one by one of this solution, because different issue may have different solution. But so far, I can say that most of duplicate issue solve by query (last solution)
1) checkbox suppress if duplicate
2) Distinct
3) Grouping
3) SQL Query (The best)

Related

Crystal Report create separate report pages based on field value change

Looking for some advice related to data grouping and printing in Crystal Reports.
I'm working with an order confirmation form. Ideally I would create separate report pages based on a specific field value change for the 'warehouse' field. So, if any given line on an order comes from warehouse A, it prints together. Then we'd get a page break, and we'd see the form repeat for any lines coming from warehouse B.
I've inserted a new group for "warehouse" and configured the group as 'New Page Before.' But when I attempt to print I'm getting an error related to "There must be a group that matches this field". So there must be some pre-existing grouping that I'm not considering. I'm hopeful I can figure this out.
I am interested to get thoughts on overall design, and if the grouping approach I am trying to take is even the correct one.
Somewhere in your report you probably have a formula such as:
Sum({some_value}, {some_field})
where the {some_field} used to be -- but is no longer -- grouped upon.
Fix that expression to set the desired aggregation level (the 2nd argument) to a field you are actually grouping on.

List all records in crystal reports, even if missing fields

I really need to make a full list of every record in our database. The problem is that if the record is missing a phone number or an address, crystal reports doesn't print it.
Phone number and address aren't necessarily always inputted in our database, but I definitly need all records included on this report, even if those fields are missing.
I really have no idea how to get these missing records included in the report, but when I delete the Phone column I see a lot of the missing records appear.
Check your joins first. Make sure that you are not linking by either of those 2 fields.
Also check your format session to see if there is any suppression condition. Sometimes when copying behavior between reports, those conditions are left behind from the previous report.
Looks like you are making inner joins for the tables which populate that data.. for these type of requirements it is suggested to use outer joins on the tables that have all data... so that you can get all records if some other tables doesn't have the required information

Crystal Report suppress a whole row in details section

I am using crystal report in my vb.net program. Because of my database design I get some rows duplicated as in the following picture:
As you can see from the picture, the first record has two printer models that have the same ink group. and the next model is the only model that has that particular ink group. As I have mentioned before This is because the way I designed the database and its not the problem. I know how to suppress a single column.
When I select a column and check "suppress if duplicate", the following results show:
The row is suppressed but also has taken a place in the report details.
My question now is how to suppress a whole duplicated row?
thank you
As you are aware that your database design is producing these type of results, one option would be check the option Select Distinct Records so that only distinct records are displayed.
One more option.. This is not a tested one change as you required, This is just an idea
write a condition in supress of the section where you placed your data.
if ID=next(ID)
then true
else false
This condition will make sure that if next row is duplicated then it will be supressed
there is many Options , Easy one Is,
you can use Grouping in Crystal report , in your Example u can Group on ID then Suppress Group Detail and Group Footer Problem Solve Have Fun with Coding

Jasper Report group subreports using columns

I have a master report (using iReport 5.0.4) with a subreport that uses grouping by a field called "Group Number" (sorry, but that is the actual column name).
My report works fine when there are more than one group, but it generates each group result scrolling down the page vertically.
I would like to be able to have each group go across vertically, but when I tried using columns, it simply forces each group's data into columns, and not the entire group 1, followed by group 2 in the next column, etc.
There can be up to 8 groups, so I was hoping not to have to create 8 individual sub-subreports with a "print when" expression to show/hide them.
Can anyone tell me if this should be possible?
Thanks,
Mitch
I think making subreports is the easiest and obvious way. But if you want to make it in other way, I can only suggest to use scriptlet, and form dataset manually (Transpose it).
Another suggestion is when you generating report directly from database (i.e. passing connection into jasper) you can modify query and transpose the data (PIVOT table).
Anyway provide more info about your case. I will try to help you.

Crystal Report show history based only on two field changes

I’m trying to write a report using the history_table.
I want to know how would I only bring the records only to show a history if only two fields have changed ex (ss.dem1) and (ss.dem2) in the table
If anything else changes like phone or address that are in the table as well to not bring that up or suppress it in the report. I want to see the data only those 2 fields have changed and every time it has changed as a history.
This would be an example of what I'm trying to accomplish.
I also used tried to use a suppression formula but only gave me the last record and not show me the example like I would of like above
not onlastrecord and next(PATID)=PATID and next(ssdem1)=ssdem1
or
not onlastrecord and next(PATID)=PATID and next(ssdem2)=ssdem2
Any help is greatly appreciated.
On the DB side you could do a self-join and only keep the records where one of those items you're interested in has changed, ex:
select WHATEVER
from HISTORY H1, HISTORY H2
where H1.PAT_ID=H2.PAT_ID
and (H1.DEM1 <> H2.DEM1
or H1.DEM2 <> H2.DEM2
etc...)
Or, you could order the report by PAT_ID, then by the date/time of the edit and then suppress the rows where nothing changes, which sounds like what you were trying to do. If you post the exact suppression formula I might be able to see where you were going wrong. Should be something like:
not(onfirstrecord) or
({TABLE.PAT_ID}=previous({TABLE.PAT_ID})
and {TABLE.DEM1}=previous({TABLE.DEM1}) //check all fields you're concerned with for equality
and {TABLE.DEM2=previous({TABLE.DEM2})
and etc...)