e3digital Posted March 12, 2003 Posted March 12, 2003 Is there any way to print the field used to perform a find as the title of a report? I have a layout called Demographics that displays information like work address, work phone, position, district, etc. the user prints from this layout often, and would like a title on it so she can keep track of who the people are she's looking at. For instance, if she does a find for Superintendents, she wants the printout to say "Superintendents" at the top. But if she looks for Grad Standards Committee (a different field), she wants that at top. Thanks for your help. Susan
Chuck Posted March 13, 2003 Posted March 13, 2003 You need to fake the find by actually having the user fill in the find criteria while in browse mode. The find criteria would entered into global fields rather than the fields themselves. Then before you actually perform the find, store which of the global fields has data in them. Here's an example script with two search fields. #Clear the global fields of any existing data Set Field [ gSuperintendent, "" ] Set Field [ gGradStandardsCommittee, "" ] Go to Layout [ Search ] #Pause to allow the user to enter the search criteria Pause/Resume Script #Clear out the gReportTitle field Set Field [ gReportTitle, "" ] If [ not IsEmpty( gSuperintendent ) ] Set Field [ gReportTitle, "Superintendent" ] End If If [ not IsEmpty( gGradStandardsCommittee ) ] Set Field [ gReportTitle, Case( IsEmpty( gReportTitle ), "", ", " ) & "Grad Standards Committee" ] End If Enter Find Mode [] Set Field [ Superintendent, gSuperintendent ] Set Field [ GradStandardsCommittee, gGradStandardsCommittee ] Perform Find []
RussBaker Posted March 13, 2003 Posted March 13, 2003 If you are scripting your finds, then the find criteria will be entered in a global field, which is then used to set the required field as part of the script. This global field can then be displayed in the header of the found records ot the printed/previewed report. If multiple find criteria are used, then you will need to combine thse into a text string for display. You would also need to script a "Show All Records" button, which cleared this global field (or set it to "All Records Visible") so that the user is aware of the status of the curretn data. If she is only using the CTRL-F method of finding, then this global field issue won't work. Give me a yell if you want any more help with setting the scripts up.
e3digital Posted March 13, 2003 Author Posted March 13, 2003 Chuck... this makes sense, except I don't understand what the Case function does in the last If statement. (I've never used that function so don't know it's results, although someone told me once that you can use it instead of nesting If functions....?) Can you enlighten me? :-)
e3digital Posted March 13, 2003 Author Posted March 13, 2003 Russ... I'm not sure I understand why I need to Show All Records, and how it's related to clearing the global field... thanks.. Susan
RussBaker Posted March 13, 2003 Posted March 13, 2003 Susan, The Show All Records would be an additional scripted button - in case the user, once they had finished looking at the superintendents, wanted to look at the whole set of records. The reason you would do this using a script (instead of the Records Menu option), is that if the user did a "Show All Records" from the Menu - the descriptor would still say that they were looking at the found set for "superintendents", so you need to clear it or change it to something that reflected the set of records being viewed. Your scripted button for "Show All Records" would then be something like: Show All Records Set Field[g_Find Descriptor,""] or Show All Records Set Field[g_Find Descriptor,"All Records Visible"] Which tells the user what records they are viewing.
Chuck Posted March 13, 2003 Posted March 13, 2003 Here the Case function could be replaced by the If function. I just always use the Case function instead because then I don't have to worry about changing it later if there's more than one test. The following two lines are equivelant. Case( IsEmpty( gReportTitle ), "", ", " ) If( IsEmpty( gReportTitle ), "", ", " ) Case is meant to be used when there is more than one test. Case( test1, result1, test2, result2, test3, result3, defaultresult ) However, when there's only one test, it works just like the If function. I've also read, but have not experimented with the idea, that the Case function is faster than the If function. Chuck
e3digital Posted March 27, 2003 Author Posted March 27, 2003 Chuck, I'm just now getting around to deploying the script you posted a few weeks ago...and I discovered a problem I'm hoping has a work-around. On the search screen most of the information a user will search for is displayed from a Value List using Check Boxes. The script works great, but the gReportTitle field displays the last value of the value list, regardless of what was searched for. Is there a way to display the value that was selected? Thanks! Susan
Recommended Posts
This topic is 7911 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