13 Replies Latest reply on Jan 6, 2014 7:42 PM by Twistan

    How do I repeat a last find request (show the last find results) ?

    Twistan

      Title

      How do I repeat a last find request (show the last find results) ?

      Post

           FM 11 Advanced

           Dear all,

           I have studied all the manuals that I have at my disposal but I have not found the solution to the following simple problem:

           The user, after having entered several variables, executes a (scripted) find request   and gets a list of results.

           Next, he enters one specific record of that list but he realizes that this record does not contain the information he was looking for.

           Therefore, he would like to re-display the set of found records instead of running the search against the entire database again.

           I have no idea how to script this because as far as I understand the find parameters are stored in the script step that performs the initial find step. When this script is terminated and a new script is run the find parameters are lost. Am I wrong here ?

           I read that it is possible to save a snapshop of found records to a temp  file but I thnk there must be a much easier way. 

           I am at the end of my tether. Can anybody of the experts give me a hint ?

           Kindest thanks,

           Twistan

            

            

        • 1. Re: How do I repeat a last find request (show the last find results) ?
          philmodjunk

               Just "entering one specific record" does not necessarily change the current found set. Often, that is accomplished just by changing from a list view layout showing all the found records in a list where clicking a button in the list (or an Item in the list) simply changes the layout to a form view layout to see the record in detail. Thus, the user might simply need to return to the list view layout to see the found records.

               And there are several ways to keep the found set intact such as by opening a new window or using two layouts based on two different occurrences of the same data source table. But I'd need to know more about your database to see if that was even needed, let alone spell out how to use that method in the context of your current database design.

               If you set up a scripted find patterned after those found here: Scripted Find Examples

               The user specified find criteria are all stored in global fields and you can simply run the find script a second time in order to recreate the found set.

               And finally, you can use Modify last find from the Records menu to return to find mode with all of the most recent find criteria still specified in their respective fields. Click perform find and you are repeating the original find--this could also be scripted.

          • 2. Re: How do I repeat a last find request (show the last find results) ?
            Twistan

                 Hi Phil,

                 thanks a lot for your ideas and suggestions.

                 The stand-alone database is fully scripted, i.e. the user can only run scripts by clicking on objects. Menus are disabled.

                 My search script is similar to yours but more complex because my script searches against user definable fields or all fields. As you said the search script stores the user's search criteria in global variables but if the user would run the scrpt again he would have to re-enter all search terms, so nothing would be gained. Moreover, before running the search script the variables are cleared.

                 After the user has executed this script he sees the found set in the same layout (List View: "Details"). Next he clicks on a record and he gets switched to a new Form View: Details layout with just the single record.

                 After that I need to give him the option to switch back to the found set in the previous layout (List View: "Details")

                 I did not get this to work with "Modify Last Find".

                 I uploaded the search script (maybe others find it useful).

                 Best,

                 Twistan

                  

                 Set Error Capture [ On ]

                 Go to Layout [ “List View” (Details) ]

                 Show All Records

                 Set Field [ Global::Query; "" ]

                 Set Field [ Global::Search Field; "" ]

                 Show Custom Dialog [ Title: "Search Term"; Message: "Enter your search terms below "; Buttons: “OK”, “Cancel”; Input #1: Global::Query, "Search Term"; Input #2: Global::Search Field,

                 "Search Field(s)" ]

                 If [ Get ( LastMessageChoice )=1 ]

                 Set Variable [ $Query; Value:Global::Query ]

                 Set Variable [ $Field; Value:Global::Search Field ]

                 If [ $Field=0 ]

            #Search in Category Field

                 Perform Find [ Specified Find Requests: Find Records; Criteria: Details::Category: “*$Query*” ]

                 [ Restore ]

            #Extend found set to results in company field

            // Go to Field [ Details::Found ]

            // Set Field [ Details::Found; 1 ]

                 Extend Found Set [ Specified Find Requests: Find Records; Criteria: Details::Company: “*$Query*” ]

                 [ Restore ]

            #Extend found set to results in URL field

                 Extend Found Set [ Specified Find Requests: Find Records; Criteria: Details::URL: “*$Query*” ]

                 [ Restore ]

            #Extend found set to results in Login field

                 Extend Found Set [ Specified Find Requests: Find Records; Criteria: Details::Login ID: “*$Query*” ]

                 [ Restore ]

                 If [ Get ( FoundCount )=0 ]

                 Show Custom Dialog [ Message: "No Records Found"; Buttons: “OK” ]

                 Show All Records

                 Else

                 Show Custom Dialog [ Message: Get ( FoundCount )&" Records Found"; Buttons: “OK” ]

                 End If

                 Else If [ $Field=1 ]

            #Serach in Company Field

                 Perform Find [ Specified Find Requests: Find Records; Criteria: Details::Company: “*$Query*” ]

                 [ Restore ]

                 If [ Get ( FoundCount )=0 ]

                 Show Custom Dialog [ Message: "No Records Found"; Buttons: “OK” ]

                 Show All Records

                 Else

                 Show Custom Dialog [ Message: Get ( FoundCount )&" Records Found"; Buttons: “OK” ]

                 End If

            Else If [ $Field=2 ]

            #Serach in Category Field

                 Perform Find [ Specified Find Requests: Find Records; Criteria: Details::Category: “*$Query*” ]

                 [ Restore ]

                 If [ Get ( FoundCount )=0 ]

                 Show Custom Dialog [ Message: "No Records Found"; Buttons: “OK” ]

                 Show All Records

                 Else

                 Show Custom Dialog [ Message: Get ( FoundCount )&" Records Found"; Buttons: “OK” ]

                 End If

                 Else If [ $Field=3 ]

            #Serach in URL Field

                 Perform Find [ Specified Find Requests: Find Records; Criteria: Details::URL: “*$Query*” ]

                 [ Restore ]

                 If [ Get ( FoundCount )=0 ]

                 Show Custom Dialog [ Message: "No Records Found"; Buttons: “OK” ]

                 Show All Records

                 Else

                 Show Custom Dialog [ Message: Get ( FoundCount )&" Records Found"; Buttons: “OK” ]

                 End If

                 Else If [ $Field=4 ]

            #Serach in Log-In Field

                 Perform Find [ Specified Find Requests: Find Records; Criteria: Details::Login ID: “*$Query*” ]

                 [ Restore ]

                 If [ Get ( FoundCount )=0 ]

                 Show Custom Dialog [ Message: "No Records Found"; Buttons: “OK” ]

                 Show All Records

                 Else

                 Show Custom Dialog [ Message: Get ( FoundCount )&" Records Found"; Buttons: “OK” ]

                 End If

                 End If

                 Else

            // Set Field [ Global::Query; "" ]

            // Set Field [ Global::Search Field; "" ]

                 Exit Script [ ]

                 End If

            // Exit Script [ ]

                 Halt Script

                  

                  

                  

            • 3. Re: How do I repeat a last find request (show the last find results) ?
              philmodjunk

                   And why doesn't simply returning to the list view layout work?

              • 4. Re: How do I repeat a last find request (show the last find results) ?
                Twistan

                     I wish I knew… 

                     To sum up the steps:

                     1) Window 1 displays all records in List View - user executes the search (script as above)

                     2) After closing window 1, window 2 displays the search results in List View - user clicks on a single record

                     3) After closing window 2, window 3 displays that single record in Form View - user wants to return to 2) 

                     When the user executes the script below he gets back the list with all records (he is being returned to window 1)

                     Could there be something wrong in the setup of the form view layout that displays the search results ?

                     Thanks and Happy New Year !

                     If [ Get ( RecordOpenState )=0 ]

                     Go to Layout [ “List View” (Details) ]

                Exit Script [ ]

                     Else

                     Show Custom Dialog [ Title: "Trap Open Record"; Message: "You must commit or cancel this record before proceeding."; Buttons: “OK” ]

                     Exit Script [ ]

                     End If

                      

                • 5. Re: How do I repeat a last find request (show the last find results) ?
                  philmodjunk

                       This is the first that you've mentioned that you have more than one window. Earlier, you just indicated that you were changing layouts to show the detail view.

                       

                            Next he clicks on a record and he gets switched to a new Form View: Details layout with just the single record.

                       What you now describe is a different approach. Each window has its own set of found sets. What you do to a found set in one window does not affect the found set in another. I see how you would use 2 windows for this, but don't get why you use three--I don't see the purpose for window 2 as it appears to show the same information as Window 1.

                       The simplest solution is not to close either Window 1 or Window 2. You can hide or minimize the window and when the user wants to return to the list, close the "detail" window and restore the hidden window with the list of found records.

                  • 6. Re: How do I repeat a last find request (show the last find results) ?
                    Twistan

                         Ooops, I think that my wording was very misleading.  I should not have said "closing window #" .

                         I am not switching between different windows, i.e. none of the script steps opens or closes a FM window, all the action taktes place in one window.

                         You are right, it would be the easiest approach to open and close new windows but I personally do not like this idea because it tends to clutter up desktops, especially when users have smaller screens.

                         Sorry about the confusion.

                          

                          

                    • 7. Re: How do I repeat a last find request (show the last find results) ?
                      philmodjunk

                           Then simply returning to the previous layout should return the user to the original found set. The only way that this will not happen is if some scripted or user action modifies the found set.

                           You can also hide windows from view so that they don't "clutter up" the screen. (I feel the same way. Most of my systems have no more than 2 visible windows open at any given time.) One way hide a window is to use the move/resize step to move the window to negative coordinates.

                           You can also have two layouts based on the same table, but which specify different Tutorial: What are Table Occurrences? of that same table. Then the found set in each layout will be independent of the other. You can link the occurrences in a relationship by primary key fields and then you can perform your find on layout 1 to get a list of records and the mouse click to select a record and view it in detail can use Go To Related Records to bring that record up in Layout 2. When you return the user to layout 1, the original found set will still be exactly as you left it so long as no script or user action navigates to a layout based on the same table occurrence and modifies it.

                      • 8. Re: How do I repeat a last find request (show the last find results) ?
                        Twistan

                             Phil,

                             I forgot to mention that the user in step 2)  triggers the following one line script by mouse clicking into a field:

                             -------------------

                             Go to Related Record [ From table: “Details”; Using layout: “Details View” (Details) ][ Show only related records ]

                             ----------------

                              

                             All layouts are based on the same table : = [Details]. The db has neither relations nor portals.

                              

                             I will check whether there is some script step that modifies the found set as you suggested.

                              

                             I am not familiar with  "linking occurrences" but will look into it in the new year.

                              

                             Thanks for your time !

                             Regards from Down Under.

                        • 9. Re: How do I repeat a last find request (show the last find results) ?
                          Twistan

                               Hi Phil,

                               I have solved all issues and I would like to share the blunders I made with others. Here is the summary:

                               Type of database: FM 11 Adv, Stand-Alone, Contents: Passwords

                               Fields: Company (1) , Category (2), URL (3) , Log-in ID (4), Owner (and other fields)

                               Purpose of the script:

                               Search for passwords belonging to a specific owner AND where search term is TRUE  for one or more of the fields (1) - (4)

                               Strategy:

                               1. Define the Global Fields "Search Term", "Search Field" and "Search Owner".

                               2.  Use the attached script #1 to assign values to the Global Variables $$Query, $$Field and $$Owner.

                               Note: the entries made in the custom dialog

                                

                          Show Custom Dialog [ Title: "Search Term"; Message: "Enter your search terms below "; Buttons: “OK”, “Cancel”; Input #1: Global::Search Term, "Search Term"; Input #2: Global::Search Field, "Search Field(s)"; Input #3: Global::Search Owner, "Search Owner" ] 

                               are stored in the three global fields "Search Term", "Search Field" and "Search Owner". (I do not know how to do this differently)

                               3. Run a sub-script to perform the search (see script #2 following post)

                               4. The Find parameters remain available for the search script  script (#2) until the global parameters have been cleared when re-running sub script 1

                               5. The search is Boulean, i.e. Perform Find must return TRUE for both variables $$Query amd $$Owner. See screen shot following script#2.

                               Take care that you enter the variables correctly. The second search category must be preceded by AND.

                               Tip: Do use the Data Viewer to see whether the variables have been set correctly.

                               I hope that helps others,

                               Twistan

                          • 10. Re: How do I repeat a last find request (show the last find results) ?
                            Twistan

                                 Here is the search sub-script #2 (part 1)

                            • 11. Re: How do I repeat a last find request (show the last find results) ?
                              Twistan

                              Here is the search sub-script #2 (part 2)

                              • 12. Re: How do I repeat a last find request (show the last find results) ?
                                Twistan

                                     Here is the Perform Find Request.

                                • 13. Re: How do I repeat a last find request (show the last find results) ?
                                  Twistan

                                       and finally the Customer Dialog Options in script #1.