Crystal Reports - Returning next value in column - crystal-reports

Need some help on crystal reports:
We are currently using crystal reports at work to generate confirmation papers to internal counterparties.
These confirmations are automatically triggered by our system when we set the interest rate on a specific deal.
The parameters that are sent from our external system are "deal number" and "action number". This information is passed on from the "events" database table, containing following columns:
The confirmation generated by performing the rate set contains specific information regarding interest payments we expect from counterparties.
So this confirmation generated has unique parameters, being the rateset "action number" and "deal number" from events table (see attached).
Now in this confirmation, we also want to make a reference to the "Next RateSet" date.
We tried to solve this by inserting an SQL statement to:
select top (1) effective date from events table where the
comments=rate set and where the action no = 0
This logic however does not hold up when we have to generate backdated confirmations.
So in theory, I would like to perform a select statement where I select the first record where the "event no" is larger than the "event no" from the current generated confirmation.
I'm not sure how to perform this though, as I've read it's not possible to use a crystal parameter in the SQL selection.
Any suggestions?

One option is to add the table a 2nd time to the report.
Crystal would assign an Alias to the 2nd instance by adding a number to the table name.
To make things more intuitive, change that alias to something like 'NextRateSet'.
Join the Events table to its alias on:
Events.Dealno = NextRateSet.Dealno AND
Events.EffectiveDate < NextRateSet.EffectiveDate
Add record selection criteria of:
NextRateSet.ActionNo = 0
Group the report on Events.DealNo and Sort it Descending by NextRateSet.EffectiveDate.
Suppress the detail section and move everything to the Group Footer.
Since the Group footer shows the last record in the group, it would show the earliest NextRateSet.EffectiveDate. And since that alias is restricted to EffectiveDates following the Events.EffectiveDate, you get the correct date.

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.

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.

Heading repeated for every record in the table

My report handles several Members based on a 4-column Members table.
For some reason, each Member is being repeated on the report for every record in the table. How can I configure this such that every member has a separate set of records?
In other words, repeating should consider "MeberName + Test" as one single unit.
Add a Group section based on your Member field. Then right click on that Group and select Section Expert. Check the New Page Before option to configure the behavior you asked for.
Additional help:
Insert page breaks between report groups with two-sided printing

How do I have a field (Table.EmployeeNo) in Crystal Reports only return data for users that are active in a parameter?

I report I'm in the process of repairing that adds up times for employees. It has two parameters; a date range parameter, and an "employee number" parameter that allows for multiple values. Crystal Reports stores a maximum of 1000 values for parameters, but we've just exceeded 1000 employees in our system. Not all of these employees are active. I would like to sort out any employee numbers from showing up in the input box for the parameter by whether or not they are listed as active.
I have a field (Table.EmployeeNo) that holds employee numbers that I have a field (Table.IsActive) that holds a "Y" or "N" value based on whether or not a user is active. How do I tell Crystal Reports to not give me any data from Table.EmployeeNo where Table.IsActive = "N" before it would prompt for parameters?
I don't need to suppress a field or anything like that. I need to make sure there is space for Crystal Reports to list a maximum of 1000 ACTIVE users as opposed to reaching it's maximum with inactive users cluttering the parameter data.
To my guess you are generating the report by joining the tables in database expert... so you are getting all employee numbers irrespective of active or not.
So the solution would be instead of table joinings you create a command and write your query with where clause having where Table.IsActive = "N"
Now in report create a dynamic parameter so that the employees that are active are retrived.
Edit........................
Example command change as per your requirement
Select *from table where table.IsActive="N"
Now place the command in command part and in design create the dynamic parameter
Create a dynamic parameter based on a command, which retrieves active users

Crystal Reports: Need to use a summary field as part of the Record Selection Formula

I have a fairly basic report that needs to show events with a total spend of >$200K OR event attendance >60ppl. The attendance portion is no problem, as it's a simple text field in the table. The expense spend is a field that has to be summed before it can be used, coming from a separate table with multiple entries per event. I have no problem doing this in a summary field dropped in the eventID header or even using a subreport and passing a shared variable to the main report. The problem I run into is that I cannot access this summary field in the report record selection to extract the either or records. Any idea how I can do this accurately?
Create a sql-expression field for total spending:
//{%total_spending}
(
SELECT sum(Amount)
FROM Meeting_Expenses
WHERE MeetingId=Meeting.Id
)
Use fields in record-selection formula:
{Meeting.actual_attendance}>60
AND {%total_spending}>200000