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

How to pull in next record if value on this record is true

Status
Not open for further replies.

dannab

Technical User
Mar 10, 2004
22
US
Im using crystal 9.0 w/sybase.
Im reading note records for employees based on a single record id.

There is a field in the returned record named nextrecord.
If the nextrecord exists, I want to read in records for the nextrecord id.

I want all notes from record 1 & any nextrecords to show.

Any ideas on how I do this?



dannab
 
Any nextrecords is a bit vague, are you saying that you might have 1000 more?

Crystal will show all records anyway, unless you state otherwise, so clarification is in order.

Crystal has the function NEXT which allows for the current detail row to read the next row's data, as in:

whileprintingrecords;
stringvar BunchOfText;
If not(isnull({table.nextrecord})) then
BunchOfText:={table.field}& next({table.field})
else
BunchOfText:={table.field}

I suspect that some form of grouping might suit your needs, but we'll need more info.

-k

Try posting example data and expected output

 
My report selection formula:
RecordId = 12345

Returns
//Record 1
Name - Susan
Record Id - 12345
Notes1 - some data
Notes2- some data
Notes3- some data
NextRecord Id - 98765

If record 1 has a valid next record Id,
requery database for Record Id = $NEXTRECORDID (98765)
and continue looping until there are no nextrecordids

dannab
 
Im reading data based on an id, using Record Selection.
RECORDID = "somenumber" 12345 (unique)

Returns this record
record id - 12345
employeenm - Janice Smith
notes1 - 250 characters of text
notes2 - 250 characters of text
nextrecordid - 98765

If NEXTRECORDID is not null, read data for nextrecordid.

What Im looking for are notes that were recorded by Janice Smith during one call that expanded over more than one record (each records notes can only contain 500 characters, before a new record is written). I want to be able to print all records associated with the specific call.

While I doubt there would be 1000 records for one call, it is possible.



dannab
 
More specific info:

Im reading data based on an id, using Record Selection.
RECORDID = "somenumber" 12345 (unique)

Returns this record
record id - 12345
employeenm - Janice Smith
notes1 - 250 characters of text
notes2 - 250 characters of text
nextrecordid - 98765

If NEXTRECORDID is not null, read data for nextrecordid.

What Im looking for are notes that were recorded by Janice Smith during one call that expanded over more than one record (each records notes can only contain 500 characters, before a new record is written). I want to be able to print all records associated with the specific call.

While I doubt there would be 1000 records for one call, it is possible.



dannab
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top