5 Replies Latest reply on Oct 30, 2012 1:24 PM by alheron

    Navigating using a field ID


      Hi Guys


      This probably seems really basic for you, but I'm stuck with a navigating problem:


      I have many records, each with it's own ID in the form (areaNumber & "." & siteNumber) to give results like 12.3, 9.4 etc and these are unique.


      I want to be able to navigate to records using these IDs rather than record numbers and I thought the best way was with script parameters, I just can't

      seem to work it out though. I don't need to create a set of found records, just navigate to one as specified by a script parameter. The idea will be to have

      hundreds of buttons (each using it's own parameter) to navigate to these records, one button per record.


      Any ideas please (preferably really simple, only basic skills here!)





        • 1. Re: Navigating using a field ID

          Hi Egbert


          This is along the lines of something I've tried already, but what I find is whatever value I put into 'Specify Find Request Criteria' is put into the ID field following a 'No records match this find' eror message. It doesn't seem to search for the contents of the ID field, it merely replaces them!  Not sure what I'm doing wrong here?


          Thanks for your help



          • 2. Re: Navigating using a field ID

            If you want to use parameters to pass the specific ID, you'll probably want to use something along these lines:


            Set Variable [ $$id ; Get ( ScriptParameter ) ]

            Go to Layout [ { appropriate layout } ]

            Enter Find Mode [ ]

            Set Field [ ID ; $$id ]

            Set Error Capture [ On ]

            Perform Find

            Set Error Capture [ Off ]


            If you get no found records, then you don't have any of that ID.






            P. S. However, I'd advise against creating "hundreds" of buttons. You're asking for a maintenance headache. Rather, create a table that holds the records and IDs you want. Then create a pull-down menu that points to that table. This is a lot easier to maintain.

            • 3. Re: Navigating using a field ID

              Hi Mike


              That's perfect, just what I was looking for!


              The reason for the 'hundreds of buttons' is because they are going to be clickable points on a country-wide map, each site (button) will take you to the relevant record.  In reality it may not work out quite as many as that, but as the solution develops I may well need to use pull downs to choose the sites.  This is all going on an iPad using FMGo 12 so I'm a bit limited for screen size as well.


              Many thanks for your help



              • 4. Re: Navigating using a field ID

                Al --


                Glad to see that this is working for you, here's one possible 'gotcha' that might come up.


                Is your ID field of type TEXT or NUMBER?  A lot of times, data built by concatenation ( you wrote areaNumber & "." & siteNumber) are TEXT fields.


                It's fine for you to do this, but if this is the case, I'd amend Mike original Set Field step in the find request to


                Set Field [ ID ; "==" & $$id ]


                which is the same as typing "==13.9" into the field when doing the search by hand.  That will be more reliable than using the value alone. 


                For example, searching for 13.9 as TEXT will give multiple results, including: 13.9, 13.90, 13.900, 13.91, etc., etc. just as searching for "Smith" returns Smith & Smithsonian.  This is expected FileMaker behavior, but we humans easily slip into seeing numbers as numbers and would probably never include more than one match.


                You can also choose to define the field as a number, but there's is no absolute requirement to do so.




                In addition to the basic script Mike lays out, you can also include some steps to account for when the found set is either 0 or more than 1 using Get (FoundCount ).  I also generally add these steps:


                Enter Find Mode

                --> If [ get ( windowMode ) <> 1 ; ] // do something smart here...back in the old FM4 days, getting to Find Mode was as reliable as one might like)

                Set Field


                Set Error Capture


                Perform Find

                --> Set Variable // so you can track the error code, if necessary, later on.

                Set Error Capture

                --> Set variable // so you can decide what to do with <1 or >1




                Drew Tenenholz

                1 of 1 people found this helpful
                • 5. Re: Navigating using a field ID

                  Hi Drew


                  Absolutely correct of course, my ID field is a text field, it did originally have an underscore as a seperator but I changed it to a stop (period) at a later stage.  I will amend the script as you suggest for safety although I don't think it too crucial in this particular project as all the buttons will be 'hard wired' and the ID number is unique, it will however act as a reminder of best practice for future projects when I refer back!


                  I also like your additional steps and I think they will also prove useful now and in the future.


                  Many thanks