4 Replies Latest reply on Feb 10, 2016 5:20 PM by AlexMauer

    mobile device aware layout selection script

    AlexMauer

      Hello, I am trying to writw a mobile device aware start up script so Filemaker go selects the right layout to use when going into filemaker go. Following examples arounf the web:

      If

      [PatternCount ( get (ApplicationVersion ) ; "Go" ) =1]

      go to Layout [“_SPACE_DATA_iphone_5c”]

      Else

      Go to Layout [“_SPACE_DATA_012816.xls_SPACE DATA”]

      End if

       

      I am making this in the script workspace and when I type IF, it looks for a clculation. I have typed the content in the script in there and it doesn't work....i Get an error on the first bracket - A number, text contant, field name or "(" is expected here" and the bracket in front of PattenCount is highlighted.

       

      So its not a calculation. I cant seem to find script editor in the Filemaker Pro 14 advance version I am using. Can Anyone help me figure out I can get this script to save much less run?

       

      Thanks,

        • 1. Re: mobile device aware layout selection script
          schamblee

           

          There is a example in the starter solutions.

          2 of 2 people found this helpful
          • 2. Re: mobile device aware layout selection script
            macwombat

            Script Workspace is the FM14 version of Manage Scripts / Script Editor.

             

            The error message you are getting happens when you have the syntax of your calculation incorrect - eg. different number of start bracket characters "(" than end bracket characters ")" or other problems with your calculation.

             

            In the calculation space you should have this:

            2016-02-11 11_35_57-Specify Calculation.png

            Which should then work in your script like this:

            2016-02-11 11_36_19-Script Workspace (test1).png

            HTH.  Chris

             

            oh ... schamblee beat me to it - great idea though, copy and paste from the starter solution to ensure you've got your syntax correct.

            1 of 1 people found this helpful
            • 3. Re: mobile device aware layout selection script
              AlexMauer

              Thanks for the help, but I am still coming up short...

               

              Im new to this too. YAY

               

              When I create a new script i type IF and it gives me brackets. You are saying that I should write it without the first bracket or th last one? because the brackets will fill in from the if statement?

               

              I changed my layout names so it will be easier.

               

              the iphone is called 5c and the desktop is called Home.

               

              I wrote it like this:

              PatternCount ( Get (ApplicationVersion ) ; "Go" ) = 1]

                 go to Layout ["Space Data" (5c)]

              Else

                 Go to Layout ["Space Data" (Home)

               

              schlambee, you seem to be saying put the table name in and the layout if I am reading the startup solution correctly.

               

              Inventory | Web (web) So I am guessing this is the table...name Inventory | web and the layout is web

               

              so I tried it with my table "Space Data" and the layout is (5c)  This is still not working as I am still getting the error on the bracket. If I leave the beginning bracket off, it hangs up on the the bracket after the 1 or after the "Go" If I remove all the brackets, it says it doesn't know the table go to layout.

               

              Thanks for your help.

              • 4. Re: mobile device aware layout selection script
                AlexMauer

                Oh Wait, I got it ...I'm writing the script, not using the steps....thats frustrating. I just got it.