1 2 Previous Next 23 Replies Latest reply on Jul 3, 2009 4:31 PM by philmodjunk

    Help with custom template

    lego

      Title

      Help with custom template

      Post

      Hi,

       

      Before I pose my question, check out these screenshots, which should help you help me.

       

      http://yfrog.com/13picture2uobpx

       

      I created a template for users to "search" the database ("Audio Database"). Then, I created a portal to display the search results (the right section of the screenshot). I don't know how to properly set this up. Please help me make it so that when a user enters a search query, the results are displayed in the portal on the right.

       

       

      Thanks in advance,

      lego

        • 1. Re: Help with custom template
          philmodjunk
            

          It's hard to see all the details in your screen shots, but I believe I can see the main problem. Since this search method is based on a multi-field relationship between search and your audio table, you'd need valid matching data in all the search fields. If the user leaves a field blank or enters partial match data such as the first few letters of a name, you'd get no matching records.

           

          I'd rethink this process. If you throw out your search table and just define global fields for specifying the search criteria, you can create a script that uses the contents of the global fields to find the records in your Audio table.

          • 2. Re: Help with custom template
            lego
              

            Thanks for your response. Currently, I can use Find, enter partial information in any of the fields, and matching results will appear--but not in the portal in a list view. The results appear in this format: http://img35.imageshack.us/img35/3296/picture3tmb.png   I want these results to appear on the right in "list" view.

             

            Also, Phil, would you describe more explicitly the alternate process you propose?

            • 3. Re: Help with custom template
              philmodjunk
                

              "Currently, I can use Find, enter partial information in any of the fields, and matching results will appear--but not in the portal in a list view."

               

              That's exactly what I'm trying to tell you. It won't work as you've designed it--or at least I understand your design. Any blank or partial data in the search fields will fail to match any records on the right. Since you've posted your screen shots of your layouts while in layout mode, I can't see any of your search criteria.

               

              "Currently, I can use Find, enter partial information in any of the fields, and matching results will appear..."

              How are you getting these matching results? Are you bringing up a layout based on your audio table, entering find mode, specifying criteria and then performing the find? Any scripted method using global fields would essentially automate this process.

              • 4. Re: Help with custom template
                lego
                  

                How are you getting these matching results? Are you bringing up a layout based on your audio table, entering find mode, specifying criteria and then performing the find? Any scripted method using global fields would essentially automate this process.

                 

                Yep, that's exactly what's happening currently. Since, according to you, this won't work the way I want it to, I'm interested in the scripted method using global fields. Can you explain this more? Step by step would be idea for a noobie like me, but whatever you have time for will be appreciated.

                 

                 

                Best,

                lego

                • 5. Re: Help with custom template
                  philmodjunk
                    

                  Since I mentioned it and you asked I'll outline it here with a single global field. If you like the idea you can add more fields to the script. I'm throwing out a qualifier here, because global fields might not even be needed.

                   

                  Place a global field, gTitle on your search layout.

                   

                  In a script:

                  Go To Layout [YourTableInListView (YourTable)]

                  Enter Find Mode []

                  Set Field [YourTable::title ; gTitle]

                  Set Error Capture [on]

                  Perform Find []

                  Sort [No Dialog, Restore]

                  Set Error Capture [off]

                  If [get (foundcount) = 0 /* No records found */]

                    Show Custom Dialog ["No records match your request"]

                    Go To Layout [Original Layout]

                  Else If [get (foundcount) = 1/* exactly one record found */]

                    Go To layout [DetailViewLayout (YourTable)]

                  End If

                   

                  The trick here is the list view layout. You can set up a layout where each record in your table is a single row with title and and a few other fields. If the criteria entered by the user matches multiple records, they get the list of matching records. If one record is found, you display a detail layout that shows all that you want them to see for that one record. If no matches are found, the user is told that fact and returned to their original layout to try again.

                   

                  On your list view layout, you place a button, or turn the entire row of fields into a button that uses:

                   

                  Go To Layout [DetailViewLayout (YourTable)]

                   

                  To display the same detail view of your record as if their search criteria had matched a single record.

                   

                  To do this without global fields, simply have the script enter find mode and pause indefinitely. The user can then enter all the desired criteria in any field on the layout. When they continue the script, use the above steps but without the set field and enter find mode steps to get the same type of result. This approach can simplify your script but relies on the user being comfortable with working directly in Filemaker's Find mode.

                  • 6. Re: Help with custom template
                    lego
                      

                    Thanks for your help, Phil. But I'm still having some trouble. Here are some screenshots of what I'm dealing with after creating a global field (gName) and adding your script:

                     

                    http://img26.imageshack.us/gal.php?g=picture6exf.png

                     

                    I need the corresponding records found from the search to appear in a "portal" next to the search field in the same tab, on the same template.

                     

                     

                    lego

                    • 7. Re: Help with custom template
                      philmodjunk
                        

                      In order for your portal list to work, you have to be able to create a valid relationship linking the current record of your layout to all the found records. That's not a simple thing to do.

                       

                      I've been suggesting that you NOT use a portal to list your results. Use a list view report of your found records. If desired, you can place your search criteria fields in the header of this layout.

                       

                      You can make a portal work, but you have to do something like the following after performing the find:

                       

                      Capture a unique ID value from each record in the found set and put it in a text field separated by carriage returns.

                      Base your portal on a relationship that links the text field to the "unique ID field"

                      • 8. Re: Help with custom template
                        lego
                           I'm starting to understand your proposed solution. The thing is, I have a neatly organized screen with three different tabs. The tab we're working on is the "Search" tab. Can the list view report work inside this tab? If so, how? I think setting this up is the "missing link" of sorts for me.
                        • 9. Re: Help with custom template
                          philmodjunk
                            

                          Sorry,

                           

                          Can't put a list report style layout inside the tab.

                           

                          You could pop the list up in a new window where clicking a button in the list of matching records takes you back to your tabs and displays the data for the clicked record though.

                          • 10. Re: Help with custom template
                            lego
                              

                            The pop up sounds good. How can I do that? Also, how do I make the list view layout? Thanks again...

                            • 11. Re: Help with custom template
                              philmodjunk
                                

                              First to make a list view layout.

                               

                              You can choose new layout and then follow the steps to create a list/report style layout and select the fields you want to appear in a list of found records.

                               

                              You'll need at least a body and a header.

                               

                              Re-size the body part of the layout so that is just tall enough to display your fields. Usually, you'll place these in a single horizontal row.

                               

                              Set the view for this layout as "list" rather than table or form. You can restrict the view to this option in Layout Setup...

                               

                              To make it "pop up", you can use the New Window command to open a new window. There are options for this script step that allow you to specifiy the size, name and location of the window.

                               

                              The trick is to keep this window "modal". You don't want your user to do anything else until they click a button on the window.

                               

                              After you've found your records in your script, insert something like this:

                              New Window [......

                              Go to Layout [your new list layout]

                              Show/Hide Status area [Lock; hide]

                              Allow User Abort [off]

                              Pause/Resume Script [Indefinitely]

                              Allow User Abort [on]

                              Close Window [current window]

                               

                              With any buttons, that you place on your layout set them exit or halt the current script and include code that closes the pop up window.

                               

                              If you do this on a windows machine, you will likely get some undesirable window sizing that cannot be completely avoided. You can minimize it if you include an adjust window step to adjust the size of the underlying window just after the New Window command.

                               

                              Be prepared to play with this a bit in order to get the window size settings and list layout design to work well together.

                              • 12. Re: Help with custom template
                                lego
                                  

                                OK. Here are some screen shots of what I have now:

                                 

                                http://img199.imageshack.us/gal.php?g=picture11ufm.png

                                 

                                I think I have a problem with my Search tab, where users enter search queries. Right now, if a user enters more than one field, the pop up doesn't display any results. I need to make the pop up find records which match all the queries entered on the Search tab. How can I do this?

                                • 13. Re: Help with custom template
                                  philmodjunk
                                    

                                  Which logic approach do you need for your find criteria?

                                   

                                  Find the records matching data in field1 and field2 and field3?

                                   

                                  Or

                                   

                                  Find the records matching data in field1 or field2 or field3?

                                   

                                  The same issue holds for check boxes. If a user clicks two check boxes, does that mean "find all records that also have these two items checked" or "find all items that have one or the other checked"?

                                  • 14. Re: Help with custom template
                                    lego
                                       The logic approach I need is the former. I want users to be able to enter all known criteria and then matching results appear in the pop up. So we're looking at field1 AND field2 AND... 
                                    1 2 Previous Next