July 6, 200223 yr I am new at using the scripting functions and calculations and am having problems trying to figure out how to create the calculations for a pop up window on the search page that will allow doing a search on all records created "today" and "the last week" and "the last month". I can create the pop up window, but do not know how to create the scripts for the above 3 time periods. If someone could reply with to this with the scripts, I would be very grateful. Thanks in advance for your help - Sam --
July 6, 200223 yr Two of the three are easy: 1) Today Enter Find Mode() SetField(Date, Status(CurrentDate) Perform Find() 2) Last Month: Enter Find Mode() Insert Calculated Result[select, Date, Date(Case(Month(Status(CurrentDate)) = 1, 12, Month(Status(CurrentDate)) - 1 ), 1, Case(Month(Status(CurrentDate)) = 1,Year(Status(CurrentDate)) - 1, Year(Status(CurrentDate))))] Insert Text[Date, "..."] Insert Calculated Result[Date, Date(Case(Month(Status(CurrentDate)) * 2, Month(Status(CurrentDate)) + 12, Month(Status(CurrentDate))), 1, Case(Month(Status(CurrentDate)) * 2,Year(Status(CurrentDate)) - 1, Year(Status(CurrentDate)))) - 1] Perform Find() ***For this script, the field "Date" must be on the current layout. "Select" must be disabled on the second two Inserts.*** 3) It depends upon what you consider "last week". Monday to Sunday? Sunday to Saturday? -bd
July 6, 200223 yr Author Thanks BD, The script you gave me was very helpful and I actually got it to work. What I should have asked for though was a script that will show the records for the last 30 days not the last month. As far as this goes: "3) It depends upon what you consider "last week". Monday to Sunday? Sunday to Saturday?" I need a script that will give results for Monday to Sunday. Thanks so much for your help, I am gratful for you spending the time to help me with these scripts. Thanks again - Sam
July 6, 200223 yr I wish I'd known that, would have been a lot easier! I took "last month" to mean for instance "June". This is why exact specification is sooo important with clients! Enter Find Mode() Insert Calculated Result[select, Date, Status(CurrentDate) - 30] Insert Text["..."] Insert Calculated Result[Date, Status(CurrentDate)] Perform Find() For "Last Week" do you want the last 7 days OR the last Monday to Sunday period? -bd
July 6, 200223 yr Author Being somewhat new to scripting with FM and also being dyslexic, I am learning how important syntax is. Thanks so much for you help in this. "For "Last Week" do you want the last 7 days OR the last Monday to Sunday period?" Last Monday to Sunday would be what I would need. Right now I am experimenting with CDML and Filemaker as a way of servicing my clients. At the present I am hosting their files with static web pages and am look towards the future where all of this will be dynamic. It will be easier and more robust for them and also more streamlined from my end in servicing their accounts. I am kind of getting out of my area of expertise and will probably be looking for someone to help get this up and running. Is this something you can do? Right now I am hosting part of the web site using a new Imac with Mac OS X Server. Thanks again for your help - Sam Sam Laundon http://www.smilepix.com picturing the perfect smile 781-899-2037 888-701-0627
July 8, 200223 yr Why so complicated? LastMonth= Date(Month(Status(CurrentDate)-1,1,Year(Status(CurrentDate))...Date(Month(Status(CurrentDate),0,Year(Status(CurrentDate)) Last30Days=Status(CurrentDate)-30 Dj
July 8, 200223 yr Couldn't do edit?!? LastXDays=Status(CurrentDate)-X LastWeek= Status(CurrentDate)-Day(Status(CurrentDate))-6...Status(CurrentDate)-Day(Status(CurrentDate))
Create an account or sign in to comment