October 10, 200322 yr 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
October 10, 200322 yr 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.
October 11, 200322 yr Author 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
October 11, 200322 yr 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
October 11, 200322 yr 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.
October 11, 200322 yr -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
October 12, 200322 yr Author 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".
October 12, 200322 yr 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
October 13, 200322 yr Author 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
October 13, 200322 yr 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!
Create an account or sign in to comment