7 Replies Latest reply on Nov 21, 2012 9:44 AM by philmodjunk

    Filter Records

    jwshelton22

      Title

      Filter Records

      Post

           Is there a way to Filter records like you would do a portal filter?

           Our older solution used a portal, but it created user issues. So now when you go to a layout for a Student , records for all classes. I need to filter the list to just show a specific Subject (like History), Every class record states what Subject it is in.

            

           thanks,

           jim

        • 1. Re: Filter Records
          schamblee

               Perform a find on your subject field. 

          • 2. Re: Filter Records
            jwshelton22

                 I tried that, it is so slow compared to a global that changed the portal filter,

                  

                 Jim

            • 3. Re: Filter Records
              philmodjunk

                   It shouldn't be any slower and could well be faster.

                   You'll need to describe what you set up in more detail if you want to explore why performing a find is so slow.

                   Slow results from a find usually are due to specifiying criteria in an unstored or unindexed field. Specifying criteria in a field from a related table will also be slower, but not as dramatic a delay as when searching on a field that does not have an index.

              • 4. Re: Filter Records
                jwshelton22

                     Here is the original portal filter calc. How would this be written for a perform script trigger step?

                      

                     (
                     Tests::SYS_id_ratings_category = Students::SYS_category_id__g
                     or
                     Students::SYS_category_id__g = "RCAT1007"
                     )

                     and

                     (
                     IsEmpty(Students::SYS_filter_display__g)
                     or
                     Contains(Tests::display__c; Students::SYS_filter_display__g)
                     )

                     __g fields are globals

                      

                     thanks

                • 5. Re: Filter Records
                  philmodjunk

                       "contains" would appear to be a custom function. Am I correct that it returns True if the text in the second parameter is contained by the text in the first?

                       What kind of fields are: SYS_id_ratings_category? Is it indexed?

                       Are you finding records in Tests or Students?

                       What is the relationship  specified for this filtered portal?

                  • 6. Re: Filter Records
                    jwshelton22

                         Contains function is not mine and there are no notes.   If(PatternCount(s; ss) > 0; 1; 0)

                         The SYS_id_ratings_category fields are Text and Indexed

                         Searching for Tests of a Student

                         Relationship

                         Student                                                                       Tests

                         SYS_Tests_set_current             =                               SYS_id_Tests_set

                         SYS_id                                       =                               SYS_ID_Student

                         SYS_k_actual                             =                               type

                          

                         The set is a grouping of Test over a period od time. The time period is not a consistent length.

                          

                         thanks,

                         Jim

                          

                    • 7. Re: Filter Records
                      philmodjunk

                           What an unecessary custom function!

                           assuming that s is the first parameter and ss the second ( s = Tests::display__c; ss =Students::SYS_filter_display__g), you could just use Patterncount ( Tests::display__c; Students::SYS_filter_display__g ) and get exactly the same results!

                           How does this relationship match to a grouping "over a period of time"? I assume that SYS_Tests_set_current does that, but can imagine two different ways that might be done.

                           One Option that I can describe now is this scripted, two part query of the Tests table:

                           Go To Related Record [Show only related records; From table: Tests; Using layout: "Tests" (Tests)]
                           Enter Find Mode []
                           If [Students::SYS_category_id__g  ≠ "RCAT1007"]
                              Set Field [tests::SYS_id_ratings_category ; Students::SYS_category_id__g ]
                           End If
                           Set Field [Tests::display__c; "*" & Students::SYS_filter_display__g & "*" ]
                           Set Error Capture [on]
                           Constrain Found Set []