14 Replies Latest reply on Feb 14, 2011 2:52 PM by philmodjunk

    GO TO FIELD NOT GOING....???

    synergy46

      Title

      GO TO FIELD NOT GOING....???

      Post

      I am using FM 11 03

      At the end of a script I have the code below:

      Setfield works.

      Go to Field does NOTHING!!!??? 

      I ran it through debug and it IS getting executed.  But, the cursor remains out of the GOT FIELD field.

      What's with that?

      (PS It doesn't make any difference if I use the Select/Perform switch in GOTO FIELD.)

      R

      ishot-474.jpg

        • 1. Re: GO TO FIELD NOT GOING....???
          davidanders

          Dues:PaidYear is a field that can be modiied? Not a field that is set  to not modify.

          Sometimes using a template with a similar script can lead to an "ah-hah"

          • 2. Re: GO TO FIELD NOT GOING....???
            synergy46

            Dues::PaidYear is a field that is modifiable.  The reason I want to 'go to' Dues::PaidYear is so the user can 'enter the year'.  I can do.  Filemaker scripting apparently can not.  What's with that?

            • 3. Re: GO TO FIELD NOT GOING....???
              raybaudi

              Is the field Dues::PaidYear on the current layout ?

              Is it the LONE Dues::PaidYear positioned on the current layout ?

              • 4. Re: GO TO FIELD NOT GOING....???
                synergy46

                Dues::PaidYear is a single field on a portal based on Members.  There is, or course a Members<>>Dues relationship.  And, yes it is on the 'current layout'. 

                • 5. Re: GO TO FIELD NOT GOING....???
                  synergy46

                  Here is another description of the problem:

                  I have a table called Members.  On this table (in a 1:many) is Dues which is a portal.

                  The fields on the Dues portal are:  DATE     DUES     YEARPAID

                  Date has an ONOBJECTSAVE trigger that runs a script called DuesDefault.

                  DuesDefault looks like this:

                  Go to Field YearPaid   -- This works

                  IF ---
                      setfield  (all setfields work and are out of the portal... but still on Members.
                  Else--
                      setfield
                  ENDIF

                  IF---
                      setfield
                  Else
                      setfield
                  ENDIF

                  >>>As I run Debugger, I can see that the Go To Field sends the cursor to YearPaid but...

                  when the script falls out of the last ENDIF, the cursor jumps to the DUES field?  A subsequent GO TO FIELD YearPaid DOES NOTHING???

                  So far I have been baffled by this for 3 days.  Pleazzzzzzz, does anyone have idea how I can get the cursor to go to YEARPAID at the end of the script?

                  • 6. Re: GO TO FIELD NOT GOING....???
                    hbrendel

                    Are you sure there is no script trigger attached to the field?

                    • 7. Re: GO TO FIELD NOT GOING....???
                      synergy46

                      Solved:  When I added  HALT SCRIPT below the GO TO FIELD IT WORKED!!!????

                      That seems goofy to me.  (But, after updating to v 11.03 lots of things have started to act goofy)

                      Thanks

                      • 8. Re: GO TO FIELD NOT GOING....???
                        philmodjunk

                        This is a side effect of the event that fires the OnObjectSave trigger. When you exit the field, the script fires first with the final Go To Field step moving the cursor to the designated field, then the event continues and your cursor pops into whatever field is next in your tab order--the final part of the event that fired the trigger in the first place.

                        Instead of a Halt Script, Exit Script [False] Can be used to cancel the triggering event so that the cursor will remain in the field where Go To Field put it.

                        • 9. Re: GO TO FIELD NOT GOING....???
                          synergy46

                          Sounds like good council.  Thanks.  But, I don't think it solves this problem:

                          YearPaid----Donation

                          2012-----------12     
                          2009-----------9
                          2008-----------9
                          2011-----------

                          When I exit 2011, the table is sorted.  This works.  but, now I want to put the cursor in the Donation field next to 2011.  What I get is the donation field next to 2012....  What am I missing.

                          Thanks for your patience.

                          • 10. Re: GO TO FIELD NOT GOING....???
                            philmodjunk

                            So these are 4 different records in a table or portal?

                            Where is the Date field on which you've set this script trigger?

                            What record are you on when the script is triggered?

                            Exactly what user action are you using to trigger it?. OnObjectSave can be triggered by pressing tab, return or enter. It can also be triggered by clicking outside the field.

                            • 11. Re: GO TO FIELD NOT GOING....???
                              synergy46

                              There are 2 tables:

                              Members <-->>Dues

                              Dues::YEARPAID ------------ DUES::DONATION   are fields in the portal on Members.

                              Dues::YearPaid has an OnSave  script trigger which runs the sort routine which sorts according to Dues::YearPaid.

                              All I want to do is put the cursor next to  the Dues::YearPaid field  that started the script.   (that would be in the Dues::Donation field)

                              I can't believe how 'incredibly dense' I am being or absent that, how FM in 11 iterations of it's wonderful platform, overlooked this?!

                              • 12. Re: GO TO FIELD NOT GOING....???
                                philmodjunk

                                Dues::YearPaid has an OnSave  script trigger which runs the sort routine which sorts according to Dues::YearPaid.

                                You are 'sorting' a portal? how do you do that?

                                It can't really be done, but there are two basic ways to simulate that and both could have a profound affect on what portal row is "current" by the time the script completes.

                                • 13. Re: GO TO FIELD NOT GOING....???
                                  synergy46

                                  You say "It can't really be done".  Wow.  I've been doing it with:

                                  SortRecords in my script.   Check it out.  It works but in my case it sorts on the YearPaid field and then puts the cursor in the top row in the next tab field.  NOT what I want.

                                  • 14. Re: GO TO FIELD NOT GOING....???
                                    philmodjunk

                                    Sort records sorts your layout's found set. It does not dynamically sort the records displayed in the portal. They are fixed in a static order specified by either the portal's relationship or the portal's sort order.

                                    The sort is pulling the focus out of the current portal row and this is why you aren't getting the cursor to end up where you want it to be after the script completes. You'd need to save the correct portal row number in a variable at the start of your script and return to it after you've sorted.

                                    If the records in the portal are sorted by Dues::PaidYear (In either portal setup or in the relationship), then it's possible for this static sort order to cause the position of the portal recors to change at the same time you sort the layout table's records with your Sort Records step--which could complicate getting the cursor back into the right portal row. In that case, you might have to save the year in a variable and then use a loop to step through the portal rows until you get to the desired portal row.