AnsweredAssumed Answered

Scripted chart selection fails

Question asked by ReSys on Apr 15, 2010
Latest reply on Apr 26, 2010 by VinceDolan


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.