September 15, 201114 yr Hi! I'd consider myself an intermediate FMP 11 user, by no means a newbie, but something simple has me stumped. Maybe it's because I've been away from FM for a while... anyway, I'm trying to find all records in a table of charitable donations within a specified month and year. Doing it manually by entering search mode and typing in "2010/8" (for example) in the Date Received field yields correct results. But scripting it, using a couple of global fields, fails - it finds all kinds of stuff beyond the intended range. Equally puzzling is the fact that when I add a Pause Script step after setting the field in question, there's nothing entered in the field. The field is being set with this line: Set Field [Globals::ReportYear & "/" & Globals::ReportMonthNumeric] Putting that in a custom dialog confirms that it is generating the correct text - it says "2010/8" - but then nothing seems to go into the field and the find, as I say, produces incorrect results. And not all records come up either, just a strange subset... Anyway, I'm sure I'm missing something obvious but can't imagine what it might be... hope someone can help! Thanks, Adam
September 15, 201114 yr Your data format throws me a bit (year/month/day). Perhaps you need the day, but use * in its place. That is your Find criteria should be 8/*/2010
September 15, 201114 yr Your Set Field statement does not tell FileMaker what field to set. Set Field [Date Received; Globals::ReportYear & "/" & Globals::ReportMonthNumeric]
September 15, 201114 yr Author Thanks all! doughemi: whoops, that was the wrong code, should have written: Set Field [Donations::Date Received; Globals::ReportYear & "/" & Globals::ReportMonthNumeric] idealdata: yes, the field is definitely set as a date field... bcooney: the date format is indeed weird, but it works... and I had a ton of trouble with date format back when I was setting things up, but it does work when set this way. Must have something to do with the date format on my computer.... Further troubleshooting clues: I tried simply hard-coding a date into the script, having it put "2010/8" or "2010/8/*" (i.e. all donations rec'd in August 2010) into the Date Received field. But when I run the script I get an error, "The provided find criteria is not valid. Enter a valid request before proceeding." And underneath the error box, I can see that nothing has been entered into the Date Received field. Arrgh! This should be so simple, can't imagine what is tripping me up here...
September 16, 201114 yr Must have something to do with the date format on my computer And your format is?
September 20, 201114 yr Author It's 2011/12/31, i.e. numerical year/month/day. I should say, I'm away from home until Thursday so have to put this problem on hiatus for a bit... But looking forward to your continued help when I return!
September 22, 201114 yr Author Sorry everyone, it is working now. I had to reverse the order of how I was stringing together the date elements in the script, and it worked. Even though I entered them in a different order outside of the script and it worked... ah well, no time to delve into why it works when I do it that way... just glad this roadblock is out of the way! Now onward to the next roadblock... 8^) Thanks for your help and suggestions!
Create an account or sign in to comment