Deprive Posted June 3, 2008 Share Posted June 3, 2008 Hey Peeps, Is it better to write a script to find records on a range of dates or a script to filter the range of dates? And how would you do it? (I'm a complete noob) Link to comment Share on other sites More sharing options...
Techphan Posted June 4, 2008 Share Posted June 4, 2008 Here is the difference I think you mean: 1) For records in a table, you can click on the magnifying glass and put in two dates separated by two periods (ie; 4/1/2008..4/15/2008). If you want to make this a little more user friendly put two global date fields in the header of the table containing the records you want to search (call them Global:StartDate and Global::EndDate). Then run a script containing these items (you can add more "things" for the script to do or even call more scripts from within this script, or call this script from another script): Enter find mode Set field (MyTable::Date; Global::StartDate & ".." & Global::EndDate) Perform find 2) The "filter" I think you were referring to is to use a portal. Let's say you are a veterinarian and have records of cats and dogs as well as treatment records for those animals. Create a layout (use form view) for an animal and put a portal in the body of the layout for treatment records. Each one of those treatment records will have a date and you can sort the portal by date. Suppose you want to see only the records for 2008. You would need to have a Treatment::Year calculated numeric field (=Year(Treatment::TxDate) and a global field in the layout (for convenience near the portal). Make the Global::Year field a drop-down value list with years defined (2007, 2008, etc) and when you choose a year (and then click outside the global date field) you will get only the treatment records for 2008. One last thing: this will only work if Global::Year is linked to Treatment::Year in the relationship tab of the manage database section. Link to comment Share on other sites More sharing options...
Deprive Posted June 17, 2008 Author Share Posted June 17, 2008 Sorry for my very late response (I was pulled off this project but now I'm back on). And Thanks for your help. I tried to construct the script as in your example, but I can 't seem to create the script in your example. It gives me error when I try to duplicate the script. Here is what I have: (Think WIP r2::Date In Shop; Think WIP r2::StartDate & ".." & Think WIP r2::EndDate) I get "The are more ")" than there are "("..." And I don't quiet understand the syntax, the start date and end date field when I named them Global::StartDate Global::EndDate it tells me I can't use the field in a calculation. I am confused. Link to comment Share on other sites More sharing options...
Deprive Posted June 17, 2008 Author Share Posted June 17, 2008 I got it! Enter Find Mode [] Set Field [Think WIP r2::Date In Shop; Think WIP r2::StarDate & "..." & Think WIP r2::StarDate] Perform Find [] Thanks point me in the right direction! But I got another problem. I do another find on the Found Set (picking out a salesman) it returns the correct result but the date range gets reset. What am I doing wrong? Link to comment Share on other sites More sharing options...
aaa Posted June 18, 2008 Share Posted June 18, 2008 Hi, Deprive. Use Constrain foundset[] script Link to comment Share on other sites More sharing options...
Deprive Posted June 18, 2008 Author Share Posted June 18, 2008 thank you! i'll give that a shot! Link to comment Share on other sites More sharing options...
Recommended Posts