6 Replies Latest reply on Jan 16, 2014 11:08 AM by dhuebsch

    Repeating Fields and Go to Object, not working - FM13

    dhuebsch

      We recently upgraded to FM13 and have found something that no longer works (This worked great in FM12). I have a script that runs OnModify of many of my input fields called "Refresh". It was modified from the original script found in the FM training series. So the script allows me to pass a Object Name back to it, so that once it performs the refesh it will go back into the field it came from. I am sure many other users have a similar script. This script has worked fine for a long time. It seems now, the script will not work on the not first repetition of a repeating field. For example my field is "InputText[2]" and the object name is "InputTwo", however when I run the script line "Go To Object "InputTwo" nothing happens. If I change the field to the first repetition it works fine. Any ideas on how to get around this besides separating my repeating field into several fields?

       

      Script:

      Capture.JPG

        • 1. Re: Repeating Fields and Go to Object, not working - FM13
          psijmons

          Use the DataViewer to see if you are actually getting a 2nd parameter.

           

          I suggest you uncheck the box for Flush cached join results and use the new script function Refresh Object

          This will make you solution a lot faster.

          • 2. Re: Repeating Fields and Go to Object, not working - FM13
            dhuebsch

            As far as my parameter, only the first one is required as I only use the second one if I need to go to a particular portal row.

             

            I did try your suggestion, however this does not work for my solution.  I am using refresh window as several other fields get updated as you change the first field. 

             

            For Example ... My most common use is to have a live updated filter on a portal list, so that as I type the filter on the portal is updated and so are the results without hitting enter.  This works fine as it is not a repeating field.

             

            Another section of my dB I have a label creator that combines fields to format a label.  Each of the parts of the label is a repetition of the repeating field.  As I said the script works great, except when the object being pointed to is a repetition of 2 or more.

             

            I have used the Data Viewer to confirm the name of this object as well as the value being passed to the script.  This is the case on several places where I use repeating fields, not just one and can be replicated over and over.

            • 3. Re: Repeating Fields and Go to Object, not working - FM13
              psijmons

              Try to add GetAsnumber ( GetValue...) when you pick up the param

              • 4. Re: Repeating Fields and Go to Object, not working - FM13
                dhuebsch

                The script parameter is not the issue.  I simplified the script down to one line "Go to Object [ "TextTwo" ]" and this still does not work

                • 5. Re: Repeating Fields and Go to Object, not working - FM13
                  erolst

                  Try something along these lines. It's a very generic script in that you don't have to pass any script parameters; all you need are (arbitrary) object names for the involved field (and the portal, if any).

                  It also returns to the original cursor position, allowing you to conveniently edit mid-text.

                   

                  DynamicRefreshAndReturn

                  #Works for fields and repeating fields, outside or inside a portal

                  #Make sure the object has an (arbitrary) layout object name

                  #The portal, too, if the field is in a portal row
                  #
                  Set Variable [ $currentObject; Value:Get ( ActiveLayoutObjectName ) ]

                  Set Variable [ $currentRepetition; Value:Get ( ActiveRepetitionNumber ) ]

                  Set Variable [ $currentSelection; Value:Get ( ActiveSelectionStart ) ]

                  Set Variable [ $portalParams; Value:List ( GetLayoutObjectAttribute ( $currentObject ; "enclosingObject" ) ; Get ( ActivePortalRowNumber ) ) ]

                  Commit Records/Requests [ Skip data entry validation; No dialog ]

                  Refresh Window [ Flush cached join results; Flush cached external data ]

                  # or (in FM13) Refresh Object [ nameOfAFieldInResultPortal ], which works more efficiently, but makes the script less portable

                  If [ ValueCount ( $portalParams ) = 2 ]

                    Go to Object [ Object Name: GetValue ( $portalParams ; 1 ) ]

                    Go to Portal Row [ GetValue ( $portalParams ; 2 ) ] [ Select; No dialog ]

                  End If
                  Go to Object
                  [ Object Name: $currentObject; Repetition: $currentRepetition ]
                  Set Selection [ Start Position: $currentSelection; End Position: $currentSelection -1 ]

                  • 6. Re: Repeating Fields and Go to Object, not working - FM13
                    dhuebsch

                    Worked like a Gem ... Thank you so much