10 Replies Latest reply on Mar 13, 2014 2:45 AM by ChrisVanBuren

    Refresh Window Bugginess

    ChrisVanBuren

      BTW, here is an experience I have had today.

       

      I have a purchase orders layout with a portal showing line items.

       

      I have a modal dialog that shows to choose items and a semi complex script to create the line items records.

       

      What was happening is that everything worked fine except the portal would still be empty after choosing items to add. This is despite the line items script committing records and despite there being a refresh window (flush cached join) being in place. Dropping into layout mode and back to browse mode fixes the problem in every case.

       

      I then tried putting in another Refresh Window script step which had no effect.

       

      I then put in a commit records at the end (affecting the PO record - not a line item record) and this fixed the problem. Note the PO record in question is months old and was definitely committed.

       

      So seems bugginess to me. Just thought it was worth sharing.

        • 1. Re: Refresh Window Bugginess
          ChrisVanBuren

          FYI, this is FM13 on Mac

          • 2. Re: Refresh Window Bugginess
            jormond

            Print the script to a PDF and paste the text here...

            • 3. Re: Refresh Window Bugginess
              Stephen Huston

              The commit on the parent record also commits the newly-created child/portal records. Until they are committed, even a window refresh may not cause them to appear.

               

              Joshua's advice to post the script may help us see why or when they are committing (or not).

              • 4. Re: Refresh Window Bugginess
                ChrisVanBuren

                Here are the scripts.  The commit below "Works" fixed the problem.  Note that the parent record is months old and is definitely committed.  As you can see, there is a commit records in the child record creation script.

                 

                Screen Shot 2014-03-08 at 11.26.42.png

                Screen Shot 2014-03-08 at 11.27.04.png

                • 5. Re: Refresh Window Bugginess
                  ChrisVanBuren

                  Here is the first script as text.  Much more legible this way:

                   

                   

                  8 March 2014 11:24:29 labelneeds_mis.fmp12 - BUTTON: Add Items (Product Selector) v2 -1-

                  Purchase Orders: BUTTON: Add Items (Product Selector) v2

                  #This adds items from keys stored in $$

                  #

                  #Strip off any leading carraige return

                  Set Variable [ $$productsIDforPO; Value:Case(

                  Left($$productsIDforPO; 1) = "¶"; Right($$productsIDforPO; Length($$productsIDforPO) - 1);

                  $$productsIDforPO

                  ) ]

                  #Strip off any trailing carraige return

                  Set Variable [ $$productsIDforPO; Value:Case(

                  Right($$productsIDforPO; 1) = "¶"; Left($$productsIDforPO; Length($$productsIDforPO) - 1);

                  $$productsIDforPO

                  ) ]

                  #

                  Loop

                  Set Variable [ $ProductID; Value:GetValue($$productsIDforPO; 1) ]

                  Perform Script [ “ROUTINE: New PO Line Item (ProductID, PO_ID)”; Parameter: xmlSet("ProductID"; $ProductID) &

                  xmlSet("PO_ID"; $$PO_ID_forProductSelector) ]

                  Set Variable [ $$productsIDforPO; Value:DeleteValue($$productsIDforPO; 1) ]

                  Exit Loop If [ IsEmpty($$productsIDforPO) ]

                  End Loop

                  #

                  #

                  Close Window [ Current Window ]

                  #

                  #

                  Refresh Window

                  [ Flush cached join results ]

                  #Makes no difference to problem of not refreshing

                  // Refresh Window

                  [ Flush cached join results ]

                  #

                  #Various attempt to get window to refresh.

                  // Go to Field [ ]

                  #Works.

                  Commit Records/Requests

                  #

                  Exit Script [ ]

                  #

                  • 6. Re: Refresh Window Bugginess
                    erolst

                    ChrisVanBuren wrote:

                    […]#Strip off any leading carraige return

                    Set Variable [ $$productsIDforPO; Value:Case( Left($$productsIDforPO; 1) = "¶"; Right($$productsIDforPO; Length($$productsIDforPO) - 1); $$productsIDforPO ) ]

                    #Strip off any trailing carraige return

                    Set Variable [ $$productsIDforPO; Value:Case( Right($$productsIDforPO; 1) = "¶"; Left($$productsIDforPO; Length($$productsIDforPO) - 1); $$productsIDforPO ) ]

                    On a side note: if you build your $$IDLists using List(), e.g. Set Variable [ $$IDList ; List ( $$IDList ; table::nextValue ) ], the above isn't necessary.

                    • 7. Re: Refresh Window Bugginess
                      Stephen Huston

                      As I indicated earlier:

                      "The commit on the parent record also commits the newly-created child/portal records. Until they are committed, even a window refresh may not cause them to appear."

                       

                      Keep in mind that uncommitted records (whether parent or child/portal) haven't actually been written to the host's disk yet, so they aren't there to be refreshed until the commit takes place. Until the commit, the record are held in the client's RAM.

                      • 8. Re: Refresh Window Bugginess
                        ChrisVanBuren

                        The parent record has been committed for months.  When the child records are created there is a commit record script step so my belief is that all records are committed.  Still the problem occurs. 

                         

                        Obviously the problem is something to do with commit as a commit records script step fixes the problem but I still think this looks like a FM bug...

                         

                        Thanks for taking a look.  I think this one will just remain a mystery.  Not a problem as it is fixed but still a mystery.

                        • 9. Re: Refresh Window Bugginess
                          Stephen Huston

                          If the child record is being created or edit via a portal from the Parent record, then the parent record -- though it already existed -- is temporarily in an "uncommitted/editing" state while the portal is active, even if the parent record's fields have not been changed. That is part of the process commit which needs to be completed before the portal records will be refreshed fully.

                          • 10. Re: Refresh Window Bugginess
                            ChrisVanBuren

                            That makes sense.  Thanks.