PDA

View Full Version : RECORD FILTERING using RECNO()



Mark C.
August 28th, 2002, 04:49 PM
I am trying to filter certain records from my database. The unusual part is that I want the group of records 11 through 15 and then each 15th record from there. For example:

Record #s needed

11 12 13 14 15
26 27 28 29 30
41 42 43 44 45
56 57 58 59 60

In short, there is a pattern in the data that groups 15 records together and then repeats. I need the last five records in each group.

Does anybody have know how I can accomplish this? I have tried numberous attempts with RECNO() function to no avail. :confused:

Steve Caiels
August 30th, 2002, 07:27 AM
Hi,

You can use a filter expression of :

mod(recno(),15)=11 .Or.
mod(recno(),15)=12 .Or.
mod(recno(),15)=13 .Or.
mod(recno(),15)=14 .Or.
mod(recno(),15)=0

This works fine for me, but I remember some time ago seeing a suggestion that you shouldn't filter directly on recno(), but should create a calculated field and filter on that. So if you have a calc field expression called myrecord with an expression of recno(), then the filter would be

mod(myrecords,15)=11 .Or.
mod(myrecords,15)=12 .Or.
mod(myrecords,15)=13 .Or.
mod(myrecords,15)=14 .Or.
mod(myrecords,15)=0

Cheers
Steve
Datawatch Europe Ltd