mzimm Posted October 10, 2003 Posted October 10, 2003 Hello: I have a button that brings the user into the correct layout and enters find mode. The user then types in a date range search 1/1/03...1/23/03 and hits a button to create the report. What I need is for this date range to be copied into a field so it appears on the print layout to show this search range. I tried to use set field then perform find but that didnt do it. How can I do this? Thanks
-Queue- Posted October 10, 2003 Posted October 10, 2003 I would either use two globals, one each for the starting and ending date, or Copy[] and Paste[] this information on a layout which holds both fields.
mzimm Posted October 11, 2003 Author Posted October 11, 2003 I wanted to use the copy and paste. What I tried to do - the user enters the layout in the find mode, the user types in 1/1/03...10/1/03 into the field and then hits the button to generate the report that script is something like copy [select,field] perform find [] paste [select,field2] I'm using a PC (if that makes a difference). When I try to run this is acts like it cannot find any matching records. I can manually perform the task -- type in date range, then copy then perform find and finally paste in my other field. How could I do this correctly if it can be done? I tried to use a modify last find but then it omitted the found set but returned the date range! Thank You
kenneth2k1 Posted October 11, 2003 Posted October 11, 2003 Hi: I would go with JT's suggestion of using two globals for the from and to ranges, then setting your date field to that range. Then you can just put those two globals on your report layout. Just to be clear, the procedure would be something like this: 1. User puts ranges is global date fields: "gFromDate" and "gToDate" and executes find script 2. Script goes: Enter find mode [ ] Set Field ["DateField" , "gFromDate & "..." & gToDate"] Perform Find [ ] Go To Layout [report] You might want some error capture in there and other stuff
-Queue- Posted October 11, 2003 Posted October 11, 2003 One small modification to Ken's steps: Set Field ["DateField", "DateToText( gFromDate ) & "..." & DateToText( gToDate )"] Dates are actually numbers to FileMaker, so they must be converted to text if you're using them in anything other than a single date calculation.
kenneth2k1 Posted October 11, 2003 Posted October 11, 2003 oops forgot. Good thing somebody's paying attention.
-Queue- Posted October 11, 2003 Posted October 11, 2003 I've done it enough times myself that I remember to check for it now.
Jim McKee Posted October 11, 2003 Posted October 11, 2003 -Queue- said: One small modification to Ken's steps: Set Field ["DateField", "DateToText( gFromDate ) & "..." & DateToText( gToDate )"] Dates are actually numbers to FileMaker, so they must be converted to text if you're using them in anything other than a single date calculation. Hi Queue ... Are you sure this will work? I've never been able to use a SetField in Find mode using the method you describe for searching on date ranges. I always get an error message to the effect of "No valid criteria were entered". Instead, I've always had to go to a Layout (in Find mode) containing the date field being searched on, and use the following: Insert Calculated Result [ date, DateToText(g_begindate) & "..." & DateToText(g_enddate) ] [ Select entire contents ] Am I mistaken about this? mzimm: see attachment date range search.zip
mzimm Posted October 12, 2003 Author Posted October 12, 2003 I did not get the setfield method to work. Using Ken's script it only searched on one of the date ranges and Queue's additions gave me some sort of total of the dates and returned a "no records found error".
kenneth2k1 Posted October 12, 2003 Posted October 12, 2003 Jim is right. Use his Insert Calculated Result step in place of the set field. Make sure the date field is on the current layout when the script is executed. Ken
mzimm Posted October 13, 2003 Author Posted October 13, 2003 Got it to work! I didnt have the date field in my report layout when I tried to use insert calc results. Thanks for all your help guys! Mike
-Queue- Posted October 13, 2003 Posted October 13, 2003 Yeah, I wasn't paying attention to the step Ken used, just the parameters in the function. I'd already answered the Insert Calculated Result [ ] question in another thread before this one, and just took it for granted that had already been clarified. Whoops!
Recommended Posts
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