Newbies Kevin S. Posted July 11, 2003 Newbies Posted July 11, 2003 I am attempting to select records where a particular field falls between two dates (defined in other fields). Yet I can't seem to get it to work. I have used several different versions of PurchaseDate > BeginningDate and PurchaseDate < EndingDate inside an If construction. If this is true, I skip to the next record inside a Loop. It it is not, the record is Omited. Any suggestions would be appreciated.
-Queue- Posted July 11, 2003 Posted July 11, 2003 This sounds about right. I would add an Exit Loop If [not Status(CurrentFoundCount)] to ensure the loop doesn't omit all records and keep going. What type of problem are you having with the loop?
Leb i Sol Posted July 11, 2003 Posted July 11, 2003 hi Kevin! Bob W. has posted a quick script that does what u need...I think! here is a snip: ========================= Enter Find Mode[] Insert Calculated Result [Date,DateToText(g_StartDate) & "..." & Date To Text(g_FinishDate)] Perform Find[] Go To Layout [Whatever layout you choose to display the found records] ===================== I hope it helps...
Fenton Posted July 11, 2003 Posted July 11, 2003 If it's a Loop problem, the commonest error is to put the Go To Next Record outside the If - End If, with the Omit inside. This makes it go to the next record, even after it Omits one, so you end up skipping lots of records. Omit by itself goes to the next record (try it manually). So you want to either Omit or Go to Next Record, not both. Loop If [ whatever ] Omit Else Go To Next Record [ Exit after last ] End IF End Loop (P.S. If the last record is Omitted, the previous record will get processed twice; because it's now the last record, and any processing generally happens before it exits. Which doesn't matter if all you're doing is looking for records. When I'm actually doing something to the "kept" records, I use a incrementing global number field, compared to the original found count, in an Exit Loop If [ _gCounter = _gCount ].)
-Queue- Posted July 11, 2003 Posted July 11, 2003 Same here. I didn't mention the omit error possibility because it seemed like he already had a good grasp of what he wanted to do. If this is true, I skip to the next record inside a Loop. It it is not, the record is Omited. Nice and succinct instruction on how to make these work as desired. You should copy this to that 'development standards' type forum, Fenton.
Newbies Kevin S. Posted July 12, 2003 Author Newbies Posted July 12, 2003 Thanks. That worked great! A much better solution than what I was trying.
Recommended Posts
This topic is 7808 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now