10 Replies Latest reply on Jul 9, 2012 3:29 PM by RobertGeraldVivona

    GetLayoutObjectAttribute("objectname";"content")   not working from server

    jake

      Summary

      GetLayoutObjectAttribute("objectname";"content")   not working from server

      Product

      FileMaker Server

      Version

      FMSA 12 .  Current Installed Version: 12.0.1.178

      Operating system version

      Windows Server 2008 R2 Enterprise

      Description of the issue

      GetLayoutObjectAttribute("objectname";"content")  does not work from FMSA, I have a FMP client installed on the server and it works from there, if I run the script from the server and try save a graph image to a container field I can't get the image to save to any type of container field whether its a global, an open storage or a secure storage.

      http://forums.filemaker.com/posts/a4e0ef1567

      Steps to reproduce the problem

      Just run a set field from FMS
      Calculation should be GetLayoutObjectAttribute("objectname";"content")

      Expected result

      Image of graph should appear in container field.

      Actual result

      No image, if there was an image that I pasted from FMP it removes it and field is blank.

      Exact text of any error message(s) that appear

      Container field is empty

      Workaround

      works from FMP not FMSA

        • 1. Re: GetLayoutObjectAttribute("objectname";"content")   not working from server
          james_quiggins

          Hello Jack:

          Thank you for posting.

          I am unable to replicate this issue on my test machine. Check your event.log for scripting errors located at Program Files > FileMaker > FileMaker Server > Logs. 

          Please clarify that I am attempting to replicate the exact same situation my steps to reproduce were:

          1. Create a Database with a container field.

          2. Upload that database to FileMaker Server Advanced.

          3. Place a image on the layout. 

          4. Name that image.

          5. Run a script with New Record then Set Field calculation result GetLayoutObjectAttribute ( "imagename" ; "content" ) 

          TSwildcat,

          FileMaker Inc.

          • 2. Re: GetLayoutObjectAttribute("objectname";"content")   not working from server
            jake
            Hi there, step 1 and 2 are correct. Step 3. Add data and add a graph Step 4. name the graph "graph" Step 5. Run a script from fms server with a set field calculation result GetLayoutObjectAttribute("graph";"content) If u run it from fmp client, no problem, fms no image
            • 3. Re: GetLayoutObjectAttribute("objectname";"content")   not working from server
              james_quiggins

              Hello Jack:

              Thank you for posting.

              Just to clarify when you say graph do you mean chart? If so what type of chart are you using? 

              TSwildcat,

              FileMaker Inc.

              • 4. Re: GetLayoutObjectAttribute("objectname";"content")   not working from server
                jake
                Yes chart, I think it was the bar chart
                • 5. Re: GetLayoutObjectAttribute("objectname";"content")   not working from server
                  jake

                  I just checked my database, its actually a column chart, but I don't think any of them work.

                  If you manage to paste any of the charts in the container field, I would really like to know how to.

                  • 6. Re: GetLayoutObjectAttribute("objectname";"content")   not working from server
                    james_quiggins

                    Hello Jack:

                    Thank you for posting.

                    I was able to replicate this issue. I am forwarding your post along with my findings to our development and testing department.

                    TSwildcat,

                    FileMaker Inc.

                    • 7. Re: GetLayoutObjectAttribute("objectname";"content")   not working from server
                      jake

                      Thank you, will you please let me know the outcome and when I will be able to use this function?

                      • 8. Re: GetLayoutObjectAttribute("objectname";"content")   not working from server
                        james_quiggins

                        Hello Jack:

                        Thank you for posting.

                        Testing informed me that chart objects aren't contained within a layout they are generated when the window is displayed. Since server side no windows are ever displayed the attribute is always going to remain empty. 

                        I have forwarded the information to our Documentation department so that it will be explained better in future documentation. 

                        TSwildcat,

                        FileMaker Inc.

                        • 9. Re: GetLayoutObjectAttribute("objectname";"content")   not working from server
                          philmodjunk

                          Note that you can schedule a "robot" file to perform a task like this from a client session instead of from a server schedule.

                          You use a system level scheduler such as Windows Task manager to "run" the robot file. The robot file has an auto-entered password such that a script in it can perform a script in your hosted file without tripping a password log in dialog. You then use FileOptions to run a script like this each time that the file is opened:

                          Perform script [//select script in hosted file here]
                          Exit Application

                          • 10. Re: GetLayoutObjectAttribute("objectname";"content")   not working from server
                            RobertGeraldVivona

                            Jack and TSwildcat,

                            It is possible the script Jack built, with set field calculation GetLayoutObjectAttribute ( "ChartObjectName" ; "content" ), is empty because of a timing issue that may be solved by immediately running the script a second time.

                            TSwildcat relayed the information that chart objects are generated within a window, typically rendered when they become viewable on a client screen. It is probable that a bitmap of a chart can be created from a window even though it is never activated by a screen display. FileMaker's Instant WebPublishing offers this feature.

                            FileMaker documentation makes it clear that scripts operate within a window: "A script is initially attached to a specific window, which may be in the background. The script remains on that window until a scripted action switches to another window." A script can give focus to a chart object and trigger a script set for 'OnObjectEnter': "In FileMaker Pro, both scripts and user actions (such as the user clicking a field) can activate script triggers." A script can include the logical function calculation 'GetLayoutObjectAttribute' set to 'content', which: "returns the content of the specified object as follows. For: ... charts - returns the bitmap representation of a chart object." This logical function implies that FileMaker at least intends to generate a bitmap of a chart and insert it into a container field or a container calculation field.

                            A script attached to a window can give focus to a chart, select all content and copy. To allow content to be copied the process of generating a chart bitmap should begin. Rendering a chart takes time and the script and the calculation does not wait. On giving focus to the chart and copying select all, the chart is initially empty - this is what is copied - then the chart is generated. This pre-generation copy is temporarily cached, so any further references to it in the script or calculation is also empty. A second script with copy select all should show the bitmap of the generated chart.

                            I believe a second script run before any other action is taken will resolve the timing issue and place a bitmap of a generated chart into a container field that can be saved in the record. However I do not know that my understanding of Filemaker is either complete or correct, so it may be that this will not work at all. TSwildcat, could you ask testing to give this a look?

                            Here is a simple pair of scripts that may work:

                            Script 1:
                            Go to Object [Object Name: "ChartObjectName"]
                            Copy [Select]

                            Script 2:
                            Go to Object [Object Name: "ChartObjectName"]
                            Copy [Select]
                            Go to Field [ContainerFieldName]
                            Paste [Select]

                            The first script begins the generation of the chart with copy. The second script copies and pastes the bitmap of the chart after it has been generated.


                            This issue I think is quite important. Many companies and professionals offer web sites that use Lasso or PHP with FileMakerPro. It would be excellent to have bitmaps of charts displayed on the web pages. Instant WebPublishing offers this feature, the documentaion indicates that it can generate a bitmap of a chart from a server. I guess a layout could be designed to appear exactly like the other web pages in a site, but how do you put javascript and schema into the html? This is required for such things as Google ads.

                            If this double scripting solution does not work, then Filemaker should offer a new script step or calculation function - modeled after the Instant WebPublishing charting solution - that will enable bitmaps of charts to be used with Lasso and PHP.

                            Thank you.