Adam Abrams Posted September 15, 2011 Posted September 15, 2011 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
bcooney Posted September 15, 2011 Posted September 15, 2011 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
IdealData Posted September 15, 2011 Posted September 15, 2011 Is "Date Received" actually defined as a DATE field?
doughemi Posted September 15, 2011 Posted September 15, 2011 Your Set Field statement does not tell FileMaker what field to set. Set Field [Date Received; Globals::ReportYear & "/" & Globals::ReportMonthNumeric]
Adam Abrams Posted September 15, 2011 Author Posted September 15, 2011 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...
IdealData Posted September 16, 2011 Posted September 16, 2011 Must have something to do with the date format on my computer And your format is?
Adam Abrams Posted September 20, 2011 Author Posted September 20, 2011 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!
Adam Abrams Posted September 22, 2011 Author Posted September 22, 2011 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!
Recommended Posts
This topic is 4810 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