MikeAz Posted June 13, 2008 Share Posted June 13, 2008 I'm attempting to create a script to open a report based on the date the records were last updated (which is an auto generated date). I have created a script that works if you open the report on the date you last updated the records, which is: New Window [] Go to Layout ["New MSDS Issue" (MSDSRegister)] Perform Find [Resotre] Print Setup [Restore; No dialog] Enter Preview Mode [] The Perform Find step (to find records that match LastUpdated to "Current Date" is: Action Criteria Find Records MSDSRegister::LastUpdated:[//] What I would like the script to do is perform a find NOT based on the Current Date, but promt the user to enter a date range (for example a search that looks in the LastUpdated field for dates between 12/05/2008 and 15/05/2008 with those two dates being a user input). The reason for this is the update process may go on for a few days before we print and issue the report. I have looked through the forum for similar requests, but no posts have been particularly useful, and any attempts I have made creating Any suggestions would be appreciated. Thankyou. Mike Link to comment Share on other sites More sharing options...
AHunter3 Posted June 13, 2008 Share Posted June 13, 2008 Set Field [YourTable::g.GlobalTextField A, ""] Show Custom Dialog ["Please enter date range, using the format Start Date \"...\" End Date" / OK / Cancel] If [Get(LastMessageChoice) = 2] .. Exit Script End If Enter Find Mode [] Set Field [YourTable:: MSDSRegister::LastUpdated, YourTable::g.GlobalTextField A] Set Error Capture [On] Perform Find [] If [Get(FoundCount) = 0] .. Show Custom Dialog ["nothing matches that date range!" / OK] End If Link to comment Share on other sites More sharing options...
davidzizza Posted August 19, 2009 Share Posted August 19, 2009 I'm sorry if I am not able to follow your scripting exactly, but if you could point out a couple of things I would appreciate it. I have the script built with a couple of issues. First is the Set Field commands. In FM 10, I can see how to add the command with one field variable, but how do you add it with two? I try to add it as is shown below but get an Expected Syntax error. Set Field [YourTable:: MSDSRegister::LastUpdated, YourTable::g.GlobalTextField A] Secondly, where is this g.GlobalTextField A coming from? Do I need to add it to the database or is it a variable that exists within the script only? Lastly, when I try to execute the script (knowing of course it is not complete), it does not prompt me for the dates in the range, though I do have the Show Message box party done I think correctly: "Please enter date range, using the format Start Date\"...\" End Date" Are those actual fields (Start Date, End Date) or are they placeholders for the user's input (or both)? Thanks for your help. Link to comment Share on other sites More sharing options...
AHunter3 Posted August 19, 2009 Share Posted August 19, 2009 I'm sorry if I am not able to follow your scripting exactly, but if you could point out a couple of things I would appreciate it. I have the script built with a couple of issues. First is the Set Field commands. In FM 10, I can see how to add the command with one field variable, but how do you add it with two? I try to add it as is shown below but get an Expected Syntax error. Set Field [YourTable:: MSDSRegister::LastUpdated, YourTable::g.GlobalTextField A] Read this and then if that does not clear everything up for you, let me know and ask more questions. Secondly, where is this g.GlobalTextField A coming from? Do I need to add it to the database or is it a variable that exists within the script only? A global field is a field and, as such, you have to define it. It can be in any table, actually, but the script assumes you define it in the same table as your FIND is being performed on. If it's not glaringly obvious from the field name, g.GlobalTextField A is a text field whose storage is set to global storage. Lastly, when I try to execute the script (knowing of course it is not complete), it does not prompt me for the dates in the range, though I do have the Show Message box party done I think correctly: "Please enter date range, using the format Start Date\"...\" End Date" Are those actual fields (Start Date, End Date) or are they placeholders for the user's input (or both)? Sorry... implicit (but not explained) in the script is that you enable field entry. The place where your user types in the date range is the field g.GlobalTextField A. FileMaker's custom dialog lets you enable field entry. Enable field entry for that field. Link to comment Share on other sites More sharing options...
Recommended Posts