6 Replies Latest reply on May 3, 2016 6:18 PM by ZoocMan85

    Duplicate Check Script

    ZoocMan85

      This is my duplicate check script. Basically what its suppose to do is check for duplicate IDs and if there are, it marks an X next to it.

       

      My setup is as followed : Drop down list of values. Script runs off on object modify trigger. I dont know what im doing wrong.

       

      I have another table occurrence that is displaying the records in a portal. In there is where you see the x.

       

      Tables: Active Brews

                  Active Brews Portal View

       

      duplicate check.jpg

        • 1. Re: Duplicate Check Script
          erolst

          You are using the wrong step: you need Perform Find, not Perform F/R.

           

          Also note this slightly shorter form of the script (declare variable only in Loop); it is generally preferable to perform the same action only once.

           

          Show All Records

          Sort

          GtR [ first ]

          RFC [ Table::isDuplicate ; "" ]

          Loop

            If [ $id = Table::id // $var must be ≠ on the first record, since it doesn't yet exist ]

               Set Field [ Table::isDuplicate ; 1 ]

            Else

               Set Variable [ $id ; Table::id ]

            End If

            GtR [ next ; exit after last ]

          End Loop

          Perform Find [ Table::isDuplicate = 1 ]

           

          Having said all that, if creating duplicates is a side effect of other scripts, fix those, rather than patching a band-aid on the issue.

          • 2. Re: Duplicate Check Script
            ZoocMan85

            Erolst,

             

            Here is my updated script. Doesnt seem to be working.  Not putting a 1 near the duplicates. : (

             

            screenshot.jpg

             

            script.jpg

            • 3. Re: Duplicate Check Script
              ZoocMan85

              Sorry Wrong screen shot of the script. This is correct one.

               

              script.jpg

              • 4. Re: Duplicate Check Script
                ZoocMan85

                Its very strange. It puts ones next to certain duplicates and not others.

                • 5. Re: Duplicate Check Script
                  erolst

                  Well, it works for me …

                   

                  Screen Shot 2016-05-04 at 02.52.32.png

                   

                  btw, you can also do this:

                   

                  Show All Records

                  Sort Records [ duplicateCheck::id; ascending ]

                  Replace Field Contents [ DuplicateCheck::isDuplicate: "" ]

                  Go to Record/Request/Page [ First ]

                  Loop

                    If [ GetNthRecord ( DuplicateCheck::id ; Get ( RecordNumber ) - 1 ) = DuplicateCheck::id ]

                      Set Field [ duplicateCheck::isDuplicate; 1 ]

                    End If

                    Go to Record/Request/Page [ Next; Exit after last ]

                  End Loop

                  Perform Find [ Criteria: DuplicateCheck::isDuplicate: “1” ]

                  • 6. Re: Duplicate Check Script
                    ZoocMan85

                    That worked . Thank you so much !