7 Replies Latest reply on Jan 7, 2014 12:25 PM by AbdoulBaldé

    HELP Regarding Script

    AbdoulBaldé

      Title

      HELP Regarding Script

      Post

           Hello, 

           I have a layout (LAYOUT A)on which I have individual buttons set up. Each button is supposed to open a new window that will show the information of another Layout (LAYOUT B). I created this script:

      SCRIPT STEPS:

           - New window (Style: floating Document)

           - Go To Layout (TABLE B)

           - Set Field (TABLE B:: Fiche_ID; Get (ScriptParameter))

           My issue is that each Button on Layout A which has a different  and unique ScriptParameter DOES not go to the associated Fiche_ID using the Fiche_ID Parameter even though It does Open the new window and goes to Layout B. 

            

      What am I missing ? 

           I tried adding the following steps  After The Last step in the above script (SET Field...)BUT TO NO AVAIL:

           - Enter Find Mode (Pause)

           - Set error capture (On)

           -- Perform Find

           -If (not Get(FoundCount))

                Show All records

                Commit records

           - End If 

            

           Could you please Help. 

            

        • 1. Re: HELP Regarding Script
          philmodjunk

               What missing is the find script that you tried at the end.

               Go To Layout (TABLE B)

               Set Field (TABLE B:: Fiche_ID; Get (ScriptParameter))

               will modify whatever record is current on the Table B layout--scrambling your data.

               You need this script:

               New window
               Go to Layout ["Table B" (Table B ) ]
               Enter Find Mode [] --clear the pause
               Go To Layout (TABLE B)
               Set Field [ TABLE B:: Fiche_ID; "==" & Get (ScriptParameter) ]
               Set Error Capture [on]
               Perform Find []

               This will pull up a found set of all records in Table B where Fiche_ID exactly equals the value passed as the script parameter.

                

          • 2. Re: HELP Regarding Script
            bruns

                 Try go to related record in script step

            • 3. Re: HELP Regarding Script
              AbdoulBaldé

                   Thanks PhilModJunk. It works. 

                   However, On My Layout TABLE B I have 2 navigation buttons (Go to Next Record / Go to previous record) 

                   How can I limit the navigation?

                   Currently, When clicking on Button 1 ==> The New Window (TABLE B Layout) pops up where Fiche_ID equals the script parameter . However, I can still access the other records by clicking on next record. or previous record.

                   Can I limit this so that The number of found sets only matches records that are equals to the scriptPArameter?

                    

                   Thanks.

              • 4. Re: HELP Regarding Script
                philmodjunk

                     I don't understand what you are describing.

                     If you have just one record with the ID specified in the script parameter, your script should only be pulling up a found set of just one record. And in that case "next record" and "previous record" buttons should fail to work as there will be no such record in your found set to "go to".

                     And if you are pulling up just a single record in a new window, why have next and previous buttons in that window's layout in the first place?

                • 5. Re: HELP Regarding Script
                  AbdoulBaldé

                       There are sometimes several records with the same Fiche_ID (Each record is a subcategory). The next and previous buttons are to enable navigation from (Fiche 1 : Content A) to (Fiche 1 : Content B) but I do not want to be able to go to Fiche 2 from the Layout. 

                       Using the script you helped me build, when clicking on Button 1 , the new window pops up  @ Fiche 1 but in the Total of records, I have All records (25). 

                  • 6. Re: HELP Regarding Script
                    philmodjunk
                         

                              but I do not want to be able to go to Fiche 2 from the Layout.

                         And that should not be possible by clicking a next record button in the newly opened window after this find is performed. The user would have to find all records, show omitted only or perform a new find before that will be possible.

                         

                              but in the Total of records, I have All records (25).

                         But the number of records in your found set should be just a few--all with the same ID value. The total number of records in your table will not change, no should it as that would require deleting records.

                         Note: With FileMaker Advanced, you can set up a custom menu for this layout that prevents the user from changing the found set--even if they try to use keyboard shortcuts.

                    • 7. Re: HELP Regarding Script
                      AbdoulBaldé

                           Hi , 

                           for some reason it works now without changing anything.

                           Thanks.