2 Replies Latest reply on Apr 26, 2010 8:46 AM by VinceDolan

    Scripted chart selection fails

    ReSys

      Summary

      Scripted chart selection fails

      Description of the issue

       FMPA 11 scripted selection of Charts fails in some circumstances. Using either GoToObject, or SetField with GetObjectAttribute/content, the chart isn't copied or set in the destination container field. The purpose is to copy charts as the report opens, so the user can always paste the chart in a wp document or whatever. Details are: Context -In FMPA 11 on OS X 10.6.3.[Full Access] privileges.Standard FMP menus.One of a series of scripts that creates a sub-summary report. The script is called by the ReportPreview script, (before entering Preview), If PatternCount ( LayoutObjectNames ( "interMediate" ; Get ( LayoutName ) ) ; "BarChart" ) > 0.This script reliably recognises reports with a chart. Chart type -Charting sub-summary data on the TrailingGrandSummary layout part. CopyChart script contains -either   GoToObject : BarChart   Copyor   SetField [ AContainerField ; GetLayoutObjectAttribute ( "BarChart" ; "content" ) ]   Copy ( Select: AContainerField ) The problem - Both of these selection methods fail when the CopyChart script runs as part of the reporting script set.If the reporting script set is interrupted so the chart can be selected manually, both versions of the CopyChart script work if the chart is first selected by the user clicking it.If the CopyChart script is run in the debugger it's more likely to work when the chart isn't selected in advance.This doesn't seem to be the result of a delay as the chart is written. It still doesn't work if the chart is on the layout, in Browse before the CopyChart script runs.In test files, containing only the minimum fields, script, layout and chart required for this to work, this works as expected. In a reasonably large system with any size data set in the report, it doesn't work unless the chart is selected as the CopyChart script starts.

        • 1. Re: Scripted chart selection fails
          TSGal

          ReSys:

           

          Thank you for your post.

           

          I am unable to replicate the problem on either Mac OS X 10.6.3 or Mac OS X 10.5.8.  As a simple test, I created a Bar Chart based upon sub-summary values and placed it in a Trailing Grand Summary.  Using Inspector, I assigned the name "BarChart" to the Bar Chart.  My script reads as follows:

           

          Go to Object [ Object Name: "BarChart" ]

          Copy [ Select ]

          Paste [ Select ; <Container Field> ]

           

          I create another script that starts at the beginning of the file and skips through, each time copying the Bar Chart and pasting it into the Container field.  In the end, each record has the Bar Chart appearing in the Container field.

           

          Maybe it would be better if you specify the steps taken prior to the copying and pasting so I can try and replicate the problem.

           

          TSGal

          FileMaker, Inc.

          • 2. Re: Scripted chart selection fails
            VinceDolan

            Folks

             

            Add a pause step (a couple seconds, maybe) just before you execute the go to object step. I think this gives the charting engine time to actually draw the char,t before coping it. Otherwise the script runs too fast and copys nothing. Worked for me.

             

            Vince Dolan

            Waymar Industries