1 2 Previous Next 18 Replies Latest reply on Mar 20, 2017 5:26 PM by keywords

    Why do Related records not show in portal

    ChrisCourtney-Stones

      Hi All, When I add records to a quote they may be added in multiples until the Quote is accepted. When a quote is accepted I now have to change any multiple service Products to single products to allow for the creation of the barcodes,(serial numbers), used during the service so that any parts used on the product are recorded against that particular product. I created a script which checks for any service Products that are showing multiples and duplicates them the required number of times. The duplication works fine in the QuoteItems layout but unless after duplication, I select either the department or product, then the items do not show in the QuoteItems portal on the Quotes layout despite the Qty being reduced from whatever it was set at to 1. The Key field is the QuoteId

      The first image is of the quote,in the Quote Layout, having been accepted, being amended by the addition of the last two portal rows.

      The next image is of the QuoteItems layout showing the items in that quote.

      The next image shows the Quote Layout after the items have been duplicated, note the Qty of the last two items in the portal

      The next image is of the QuoteItems and shows that the items have been duplicated.

       

      (sorry but the attachments appear to be in reverse order)

       

      Here is the script used to duplicate the Products

      Set Error Capture [ On ]

      Loop
      Set Variable
      [ $QuoteId; Value:Quotations::__QuoteId ] Go to Layout [ “dLayQuoteItems” (QuoteItems) ]

      Enter Find Mode [ Specified Find Requests: Find Records; Criteria: QuoteItems::QTY: “>1” AND QuoteItems::_QuoteId: “$QuoteId” AND QuoteItems::ServiceFlag: “=1” ]
      [ Restore ]

      Perform Find [ ]
      If [ Get (LastError) = 401 ]

      Go to Layout [ original layout ]

      Exit Script [ ] End If

      Go to Record/Request/Page

      [ First ]

      Set Variable [ $QTY; Value:QuoteItems::QTY ]

      Set Field [ QuoteItems::QTY_Count; $QTY ]

      Set Variable [ $QTY_Count; Value:QuoteItems::QTY_Count ]

      Insert Calculated Result [ QuoteItems::QTY; 1 ] [ Select ]

      Commit Records/Requests

      [ Skip data entry validation; No dialog; Force Commit ]

      Loop

      Duplicate Record/Request

      Insert Calculated Result [ QuoteItems::QTY; 1 ] [ Select ]

      Insert Calculated Result [ QuoteItems::QTY_Count; $QTY_Count-1 ] [ Select ]

      Set Variable [ $QTY_Count; Value:QuoteItems::QTY_Count ]

      Commit Records/Requests

      [ Skip data entry validation; No dialog ]

      Exit Loop If [ QuoteItems::QTY_Count = 1 ]

      End Loop

      End Loop

        • 1. Re: Why do Related records not show in portal
          philmodjunk

          "but unless after duplication, I select either the department or product, then the items do not show in the QuoteItems portal on the Quotes layout"

           

          Sounds like a portal filter is excluding the records.  "Selecting product or department" appears to change data in a field either directly or indirectly such that the record now passes the portal.

          • 2. Re: Why do Related records not show in portal
            ChrisCourtney-Stones

            Hi, thank you for your response. Neither filtering nor sorting is enabled in the portal.

            • 3. Re: Why do Related records not show in portal
              philmodjunk

              Then check the match field values used in the relationship on which the portal is based. If a new record does not appear in an in an unfiltered portal, either it is not related or the record was created in a different window and has not been committed yet.

               

              Your script has some odd details, but none that seem likely to be what would keep a record out of portal. I'd look for script triggers and aut-enter options that do something when you select a product or department.

              1 of 1 people found this helpful
              • 4. Re: Why do Related records not show in portal
                ChrisCourtney-Stones

                The match field used in the relationship is the QuoteId, which is in the 5th column along in the QuoteItems image, and as you can see it is populated. I also thought that the problem could have been caused by the records not being committed so as you can see in the script I specifically set a Commit Record step after each duplication.

                 

                "I'd look for script triggers and aut-enter options that do something when you select a product or department."

                I have a feeling that the answer lies here somewhere but finding it is fun

                • 5. Re: Why do Related records not show in portal
                  keywords

                  The match field used in the relationship is the QuoteId, which is in the 5th column along in the QuoteItems image, and as you can see it is populated.

                  That may be so, but something is not right. I note that the Serial column in the two screenshots showing the portal is empty for the last two records, suggesting that data is incomplete somehow.

                  • 6. Re: Why do Related records not show in portal
                    ChrisCourtney-Stones

                    On accepting a Quote, the first portion of the acceptance script is to duplicate any service items that are shown as multiples, it is only after that the serial number is  generated when the quote is accepted and it produces the barcode number

                    • 7. Re: Why do Related records not show in portal
                      rgordon

                      Have you tried adding a refresh portal step to the end of your script?

                      • 8. Re: Why do Related records not show in portal
                        ChrisCourtney-Stones

                        Hi, I had put a Refresh Window in the next part of the script, but following your suggestion have just added a Refresh Portal step to the end of this script but it has no effect.

                        • 9. Re: Why do Related records not show in portal
                          philmodjunk

                          There are only three things that willl keep a record out of a portal. Either match fields don't match, they don't pass a filter or you have a batch of uncommitted records.

                           

                          I suggest posting a screen shot of the relationship used.

                          • 10. Re: Why do Related records not show in portal
                            ChrisCourtney-Stones

                            Here is a screenshot of the relationship between the Quote Table and the QuoteItem Table

                            • 11. Re: Why do Related records not show in portal
                              ChrisCourtney-Stones

                              Here is a screenshot of the Portal setup as well.

                              • 12. Re: Why do Related records not show in portal
                                philmodjunk

                                is _QuoteID a text field?

                                 

                                It's a bit of a long shot, but click into the _QuoteID fields of the newly created records and confirm that there is no extra text present in those fields that might not be visible in your screen shot. A trailing space or other non-printing character is one possibility. Don't see how that could happen, but it would explain what we see.

                                 

                                Assuming that no such text appears...

                                Now post a screen shot of your layout with the portal, but this time taken while in layout mode. Also, check layout set up and show/tell us what is selected in "show records from".

                                 

                                BTW, you can post images using the picture icon in the regular reply's tool bar and the images will appear inserted into your reply.

                                 

                                Here are some odd aspects of your script that have no apparent bearing on this issue but which you might think about once this issue is resolved:

                                 

                                Set Field [ QuoteItems::QTY_Count; $QTY ]

                                Makes no sense, the previous step just set the variable $Qty to the value of this field so you are setting a field to a value that it already has.

                                 

                                Insert Calculated Result [ QuoteItems::QTY; 1 ] [ Select ]

                                It would be better to use Set Field instead of these "insert" script steps. They trip script triggers and only work if the target field is present on the current layout.

                                 

                                Insert Calculated Result [ QuoteItems::QTY_Count; $QTY_Count-1 ] [ Select ]

                                Set Variable [ $QTY_Count; Value:QuoteItems::QTY_Count ]

                                Commit Records/Requests

                                [ Skip data entry validation; No dialog ]

                                Exit Loop If [ QuoteItems::QTY_Count = 1 ]

                                 

                                Makes no sense. You can just use:

                                 

                                Set Variable [ $QTY_Count; Value: $QTY_Count - 1 ]

                                Exit Loop If [ $QTY_Count = 1 ]

                                 

                                Just to repeat, I see no way that these details have anything to do with records not appearing in your portal. Short of a damaged file--which is highly unlikely, I've already listed the only three ways that a record would not appear in your portal.

                                I also recall other details not present in the script today. Either my memory is playing tricks on me or you've edited your original posted script.

                                • 13. Re: Why do Related records not show in portal
                                  ChrisCourtney-Stones

                                  Hi again, your time help is very much appreciated.

                                  The QuoteId field is a text field and when selected in the newly created records shows no extraneous characters, which I wouldn't expect anyway as it is a duplicate record..

                                  Quote Layout:

                                  Screen Shot 2017-03-20 at 17.22.58.png

                                  I had posted the portal setup this is the table setup:

                                  Screen Shot 2017-03-20 at 17.34.08.png

                                   

                                  "Set Field [ QuoteItems::QTY_Count; $QTY ]

                                  Makes no sense, the previous step just set the variable $Qty to the value of this field so you are setting a field to a value that it already has."

                                   

                                  Agreed, this step was in place as the original script only duplicated individual products so this was in an enclosed duplication loop. As a change can be made anywhere up to 200 items from the first portal row and is being entered on a mobile device (phone) I built the loop to check all items rather than duplicate one item and then have to scroll madly looking for any other item.

                                   

                                   

                                  Insert Calculated Result [ QuoteItems::QTY; 1 ] [ Select ]

                                  It would be better to use Set Field instead of these "insert" script steps. They trip script triggers and only work if the target field is present on the current layout."

                                   

                                  Agreed, done

                                   

                                  "Insert Calculated Result [ QuoteItems::QTY_Count; $QTY_Count-1 ] [ Select ]

                                  Set Variable [ $QTY_Count; Value:QuoteItems::QTY_Count ]

                                  Commit Records/Requests

                                  [ Skip data entry validation; No dialog ]

                                  Exit Loop If [ QuoteItems::QTY_Count = 1 ]

                                   

                                  Makes no sense. You can just use:

                                   

                                  Set Variable [ $QTY_Count; Value: $QTY_Count - 1 ]

                                  Exit Loop If [ $QTY_Count = 1 ]"

                                   

                                  I had no idea that you could use a variable to set a modified version of itself as a variable !!!

                                   

                                  The script in the OP has not been changed at all, I did post another version of this with only very minor differences on FMForums last week

                                  • 14. Re: Why do Related records not show in portal
                                    philmodjunk

                                    I myself pointed out that it would be very unlikely that there were extra characters in the _QuoteID field, but since we'd looked at more likely scenarios...

                                     

                                    Frankly, I see no reason why those additional records do not appear in the portal.

                                     

                                    Can you expand on this statement?

                                    I select either the department or product, then the items do not show in the QuoteItems portal on the Quotes layout

                                    What exactly are you selecting and in what? A field in quotations? QuoteItems? Have you checked to see what else might be taking place when you do that? Such as tripping a script trigger or some fields with auto-enter options that update when you do that?

                                     

                                    And since we've checked all the likely suspects, another long shot would be to recover the file and test the recovered copy. If this works in the recovered copy, you may have a messed up index. In which case, you could either rebuild the index for _QuoteID in the QuoteItems table or use advanced recover options to rebuild all indexes in your file to see if either of these fix the problem. (Select "copy file blocks as is" and "Rebuild indexes now" in Advanced Recover options.)

                                    1 2 Previous Next