6 Replies Latest reply on Apr 24, 2013 12:27 PM by Mike_Mitchell

    Copying chart


      I'm putting a chart onto a report layout in FM11. The chart uses a different found set and sorting order from the layout being used to print.


      I jump to the layout with the chart element on it, perform the find and sort - the chart generates properly.


      I then want to put the chart into a container field. I'm using the GetLayoutObjectAtribute function with the "content" parameter. It grabs the chart and puts it into a global container field.


      When I step through the script in debugger - works perfectly.


      When I run the script normally - the chart doesn't appear in the container field.


      I tried using refresh, pauses, nothing seems to work.


      Any thoughts?

        • 1. Re: Copying chart

          Of course - it works perfectly in 12.

          • 2. Re: Copying chart
            Stephen Huston

            You indicated that it "works perfectly" with script debugger but fails when run normally, which suggests to me that you are stepping through it when using debugger.

            1. Does it work in debugger if you don't step thru but just use pause on error only?
            2. Does your script include a commit record step after the chart has been placed into the global container?
            • 3. Re: Copying chart

              I've done this in 11 and 12. The key, at least in my case, was a slight pause (like 0.1 second) seemed to be required. No idea why, but placing a Pause Script step in there after the Refresh Window seemed to make it work.



              • 4. Re: Copying chart

                I would try as Mike suggested.  Include the slight pause.  I often find a pause necessary when you are handling something that is dependent upon the screen redrawing.


                Another option, or perhaps a combination of both, I would test using the Freeze Window script step instead of Refresh Window.  I very rarely use Refresh Window, because of the effect it has on Windows users.  Freeze Window does what I need 99% of the time.  And in many instances, can be used instead of a Pause Script - Refresh Window to achieve the desired result.

                • 5. Re: Copying chart

                  I had the pause in the wrong spot. Two script steps - the sort and then the set field to grab the chart and put it into the container. I had the pause after the set field step. As soon as I moved it to BEFORE the set field step it worked fine.


                  Thanks all.

                  • 6. Re: Copying chart

                    Bingo. The pause is there to allow the chart object to render. I think. At least that's my rationalization for why it works.