Leather Knight Posted November 22, 2008 Posted November 22, 2008 I have a need to make a button for reports. I want to have a screen pop up and ask "Date Range" and show records in that date range. Any advice?
mr_vodka Posted November 22, 2008 Posted November 22, 2008 You can either use a custom dialog with 2 input fields or use a popup window. In both cases, you can use global fields to capture the user criteria and then have a script that finds records in that range either using a find script or a GTRR.
Leather Knight Posted November 22, 2008 Author Posted November 22, 2008 Yes, that is what I am trying to figure out. If I want to have the custom dialog box show the search criteria be a date range from "Date of Acquisition" and have all records show from that range, how would I accomplish this?
LaRetta Posted November 22, 2008 Posted November 22, 2008 (edited) I'm not particularly pleased with the script ... it could be functionally sweetened and should be rearranged. That's what happens when I get in a hurry. And I see I switch to table view even with no records found. Without rearranging the whole thing, it can be corrected as the green indicates ... Perform Find [ ] If [ not Get ( FoundCount ) ] Show Custom Dialog ... yada yada [color:green]Exit Script or [color:green]Halt Script End If Actually, I would include this in a loop to allow User to try a different range so I would certainly restructure a bit. But this gets you going on how it works and I feel lazy today. :shocked2: Edited November 22, 2008 by Guest
Leather Knight Posted November 22, 2008 Author Posted November 22, 2008 You are fantastic! That is what I needed... I can relate, I am beat from working all week myself.
Newbies hatchethead Posted December 7, 2008 Newbies Posted December 7, 2008 Thank you for your post. It's helping me solve a problem, but I was hoping you could help me understand how to adapt the solutions to my situation. I have a budget database and I was to create a script that will generate a sub-summary report for a found set determined by conditions set by a user. I have a settings/preference table with global fields for the settings, and I have those fields+values displayed on a layout along with the 'generate report' buttons. What I want to know how to do is to pull the global values into my script as parameters. (I bet this is an embarrassingly easy question to answer.) Thanks for whatever pointer you can share.
LaRetta Posted December 8, 2008 Posted December 8, 2008 (edited) Hi hatchethead, welcome to FM Forums!! I will assume then that the User is presented with the global fields, fills in what they want, and clicks 'generate report' button. Script attached to that button would look something like this: # First test to make sure required data is entered and entered correctly # Only you will know how to adjust these tests to meet your needs but I will give generic examples # Test ... make sure there are dates in the gStart and gEnd date range globals If [ not gStart or not gEnd ] Show Custom Dialog [ OK ; "You did not enter " & Case ( NOT gStart ; "a start" ) & Case ( NOT gStart AND NOT gEnd ; " nor " ) & Case ( NOT gEnd ; "an end" ) & " date." ] Halt Script End If # Test ... make sure there is a gCustomerType entered If [ IsEmpty ( gCustomerType ] Show Customo Dialog [ OK ; "You must enter a Customer Type." ] Halt Script End If # Everything is correct in the globals; proceed with report ... Freeze Window Go To Layout [ sub-summary report layout based upon Budget ] Enter Find Mode [ uncheck pause ] Set Field [ Budget::BudgetDate ; Preferences::gStart & ".." & Preferences::gEnd ] Set Field [ Budget::CustomerType ; Preferences::gCustomerType ] Set Error Capture [ On ] Perform Find [ ] If [ not Get ( FoundCount ) ] Show Custom Dialog [ OK ; "No records found." Go To Layout [ original layout ] Halt Script End If # Records found, sort and go to preview mode Sort [ without dialog ; by Customer Type ] Enter Preview Mode [ pause ] Enter Browse Mode [ ] Go To Layout [ original layout ] If you get stuck on adjusting any of this to your specific needs, just ask and we'll help you through it. There are many wonderful people here on FM Forums and we have ALL been in your shoes before. There are no dumb questions except those unasked. LaRetta UPDATE: Changed the calc in the Custom Dialog ... poor english (said: nor [color:green]a end date instead of [color:green]an end date. Now corrected. :blush2: Edited December 8, 2008 by Guest
Recommended Posts
This topic is 5831 days old. Please don't post here. Open a new topic instead.
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