Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Previous() function not pulling previous record?

Status
Not open for further replies.

mrpatak

MIS
Mar 5, 2013
12
0
0
US
I have a report I'm working on rebuilding in a new format that has two groups, which are then additionally sorted in the Record Sort Expert by date. The report calls for the previous month's data to be compared to the current month's, which had been done with the previous function in the former report. However, with the new report, the previous function does not pull the previous month, but the first month for that specific area. The function does work when I look at the specific records for any given area (not sure what this view is called - where you can see all the details listed out). Any help or suggestions on this would be appreciated.
 
The Previous() function looks only at the record that immediately precedes the record that currently is being processed. So, assuming you're looking at this in the details, you would need to be sure to sort the data ascending by date inside of any groups that you may have in the report.

-Dell

DecisionFirst Technologies - Seven-time SAP BusinessObjects Solution Partner of the Year
 
How would I sort the data inside the groups then?
 
Go to the Sort Expert. Any sorts that you apply there will happen after the sorts for your groups.

-Dell

DecisionFirst Technologies - Seven-time SAP BusinessObjects Solution Partner of the Year
 
If you're referring to the Record Sort Expert, I have already done that.
The fields are showing up properly in the details, but not in the actual report.
 
A formula using Previous() is calculated at the detail level only. It only pulls from the previous detail record, even if that detail record is hidden. It won't go from one group to another and it doesn't go back to the previous visible row of the output. It sounds like the formula works correctly when you expose the details and then you expect it to work differently 'in the actual report' when you hide the details.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top