Newbies dhsweene Posted May 27, 2013 Newbies Posted May 27, 2013 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
doughemi Posted May 27, 2013 Posted May 27, 2013 Button script: Go to Layout ["YourDisplayLayout"] Enter Find Mode Set Field[YourTable::Week; WeekOfYear(Get(CurrentDate))] Perform Find
Lee Smith Posted May 27, 2013 Posted May 27, 2013 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
Newbies Travelindude99 Posted June 11, 2014 Newbies Posted June 11, 2014 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
comment Posted June 11, 2014 Posted June 11, 2014 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.
Recommended Posts
This topic is 3818 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