May 27, 201312 yr Newbies Hi, I'm very new to Filemaker Pro, and am just writing my first basic scripts for a project. With a button, I'm trying to filter my results to show me the records from the current week of the year. My records are set up with a "Week" field that auto enters the current week number when new records are created. Now I want to have a button that shows me all the records from the current week and then display them on another layout. I have this script working properly if I specify the week number in the Find request step, but I can't figure out the syntax to make it compare the current week number with the "Week" field in the records Thanks in advance. Dana
May 27, 201312 yr Button script: Go to Layout ["YourDisplayLayout"] Enter Find Mode Set Field[YourTable::Week; WeekOfYear(Get(CurrentDate))] Perform Find
May 27, 201312 yr Read about "Finding Ranges of Information" To find a week of information, you will need to know what constitutes your week. Do you want Sunday thru Saturday, or are you looking for 7 days prior to today? Take a look at this custom function by Ocean West that you can find at Brian Dunning's site MagicDates Lee
June 11, 201411 yr Newbies Lee, Another newbie with a question about this older post... I've looked at the magicdates custom function. I'm curious how one would use it in a script to find records; I imagine it would be similar to what Doughemi has outlined in his example above but I believe that some changes would be necessary. Any immediate thoughts? TIA. Travelindude
June 11, 201411 yr I'm curious how one would use it in a script to find records It really depends on your specific application; keep in mind that the function is designed to allow users to input a variety of text phrases instead of typing a date range. If your script is supposed to always find records of the current week, then using this function would be an unnecessary complication. My records are set up with a "Week" field that auto enters the current week number when new records are created. I was away when this thread started, otherwise I would have commented on this: This is not a good method to record the week in which a record was created. And it's certainly not a good place to search for records that were created in a given week - because such search would find records that were created in week X of any year. In addition, there's a problem of weeks crossing the year boundary, which I won't go into now.
Create an account or sign in to comment