Can anyone tell me how to return the actual number of records visible after setting a range?
To preface this, I've been using Alpha for a very short time, coming from a Clipper background. I'm attempting the equivalent of a SET FILTER TO expression, but queries and ranges are as close as I can get.
I got a query to work OK, but I thought I'd try a range, since the manual makes it sound like if someone adds a record during the search, the range will be updated.
Consider the UDF below. The "test" tag is indexed on PRODID, which I pass into the UDF as "id". I just want to see records matching "id" that fall between the specified date range.
For the life of me, I can't get this range to work, and I can't even tell how many records it is returning.
I'm beginning to feel like there's a bug in ranges if the first & last values are the same.
Anyone have a clue as to what I'm doing wrong? Or am I just beating my head against a wall?
FUNCTION aging AS N (id AS C )
t= table.open("volume")
i= t.index_primary_put("test")
dstart = date()-150
dend = date()
range.flags = range_index .or. range_first .or. range_last .or. range_filter
range.index_pointer = i
range.filter = "between(entrydate,dstart,dend)"
t.range_add(id, id)
ntot = 0
while .not. t.fetch_eof()
ntot = ntot + t.stockcur
t.fetch_next()
end while
aging = ntot
END FUNCTION
Thanks,
Rick
To preface this, I've been using Alpha for a very short time, coming from a Clipper background. I'm attempting the equivalent of a SET FILTER TO expression, but queries and ranges are as close as I can get.
I got a query to work OK, but I thought I'd try a range, since the manual makes it sound like if someone adds a record during the search, the range will be updated.
Consider the UDF below. The "test" tag is indexed on PRODID, which I pass into the UDF as "id". I just want to see records matching "id" that fall between the specified date range.
For the life of me, I can't get this range to work, and I can't even tell how many records it is returning.
I'm beginning to feel like there's a bug in ranges if the first & last values are the same.
Anyone have a clue as to what I'm doing wrong? Or am I just beating my head against a wall?
FUNCTION aging AS N (id AS C )
t= table.open("volume")
i= t.index_primary_put("test")
dstart = date()-150
dend = date()
range.flags = range_index .or. range_first .or. range_last .or. range_filter
range.index_pointer = i
range.filter = "between(entrydate,dstart,dend)"
t.range_add(id, id)
ntot = 0
while .not. t.fetch_eof()
ntot = ntot + t.stockcur
t.fetch_next()
end while
aging = ntot
END FUNCTION
Thanks,
Rick
Comment