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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

“Next” function in Crystal Report 8.5

Status
Not open for further replies.

bhfmc

IS-IT--Management
Jun 18, 2003
29
US
In the Record Selection Formula Editor of my Crystal Report, Prospective Students by Major v5, the formula ends with:
((IsNull ({SARAPPD.SARAPPD_APDC_CODE}) OR
{SARAPPD.SARAPPD_APDC_CODE} = '01' OR
{SARAPPD.SARAPPD_APDC_CODE} = '05') AND
Next ({SPRIDEN.SPRIDEN_ID}) <> {SPRIDEN.SPRIDEN_ID})
-----
When “X-2” checking the formula, this error message appears just before the “Next” function: “This function cannot be used because it must be evaluated later.”
I must not understand “Next”. I want to compare the values of the current row’s ID with the next row’s ID to make certain they are different.
 
You can't use it in the record selection formula.

So what you want are unique id's, so group by the {SPRIDEN.SPRIDEN_ID} and place your fields in there.

You're might be best served to post example data and expected output.

-k
 
You cannot use &quot;next&quot; in the record selection formula since this formula is used in the process of gathering the records and hence at that point in time it has no idea what is the next record.

Once you have your records collected and sorted , then you can apply your &quot;Next&quot; criteria during the printing of the report.

Jim Broadbent
 
synapsevampire and ngolem,
Thanks for the repsonse. As suggested, I'm providing current output and desired output. Without any selection criteria my ouput was:
@00007251 01
@00006486 01
@00006486 00
I then used this code & got the following output:
{SARAPPD.SARAPPD_APDC_CODE} <> '00' AND
{SARAPPD.SARAPPD_APDC_CODE} <> '03'
@00007251 01
@00006486 01
The output I wanted is just one row:
@00007251 01
In other words if the person whose ID is @00006486 has a code of 00 (or 03) in one of several rows, I want to eliminate all rows for that ID.
Perhaps the solution would avoid using Next; but I might, with more instruction, use Next during the printing of the report.
 
First group on {table.personID}. Then create a formula {@code0003}:

if {SARAPPD.SARAPPD_APDC_CODE} in [00,03] then 1 else 0

Place this in the details section and suppress.

Go to record->edit selection formula->group and enter:

Sum({@code0003},{table.personID}) = 0

This will return only those people who don't have code 00 or 03.

-LB
 
My approach would be to Group on ID

Do not include your filtering criteria

{SARAPPD.SARAPPD_APDC_CODE} <> '00' AND
{SARAPPD.SARAPPD_APDC_CODE} <> '03'

Now in the ID group header put the formula

//@initialization

numberVar sFlag := 0;


Now in the conditional suppress of the detail section place the formula

numberVar sFlag;
if next({SARAPPD.ID}) = {SARAPPD.ID} or sFlag = 1 then
(
sFlag := 1;
true;
)
else
false;

This should do the trick




Jim Broadbent
 
Ibass,
Wow! It works! Why couldn't I have thought of that; I've been all around the edges of your technique but just hadn't broken through. Many thanks; I am indebted to you.
Ngolem,
I was bit frightend by the &quot;//@initialization&quot; command and others in your solution, but was nevertheless intrigued by it. With a little more explanation, I'd like to try your approach.
 
nothing really frightening there...just create the formula and place it suppressed in the Group header....and create the other one as described and it should work for you....you must get your feet wet sometime.

Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top