Hello,
First, excuse my bad english, i'm french :-)
I discover idea script, i have a lot of request to do in a big table. (> 100 000 records).
So i want to use "criteria" with a recordset.
like : rs.criteria " XXXX > 20150101 "
I have a problem :
My equation is ok, and when i browse my recordset the filter is ok ( rs.next).
But i browse the result with a loop like " While i < rs.Count"
The problem is : rs.Count don't return the number of record which match the criteria, but the whole records... So my loop don't work
Exemple : 1000 record , just 10 match the criteria. rs.Count return 1000 and not 10
It's a bug ? if not how can i know the number of record which match the criteria ?
Tks
partitionfrance
Offline
Last seen: 4 years 10 months ago
Joined: 09/09/2016 - 11:15
I'm using IDEA V9.
My source code :
Dim rs As RecordSet
Set rs = base.RecordSet (100 000 records )
rs.Criteria=" NBPEOPLE> 1000" ( only 10 records match)
rs.tofirst
i=1
do
rs.next
'......
i++
Loop until i>rs.Count (rs.Count return 100 000 and not 10, so an error occured at the record number 11)
Hello and welcome to the site.
The rs.count will always return the total number of records from within the database. The Criteria is only applied as you loop through all the transactions. So to obtain the 10 items based on the criteria you would need to add a counter within your loop to count how many transactions actually meet your criteria.
I have modified the example from the language browser and added a variable count1 to count the number of transactions that meet the criteria. It uses one of the sample database so you should be able to paste this into the editor and try it out.
Hope this helps.
Brian
Thks, this solution works fine. ( for my opinion it's not very clean to generate an error, but this solution is simple and it work).
Thanks Brian:-)