11 Replies Latest reply on Apr 18, 2016 4:23 AM by cillion

    Filtering portal with 3 global fields

    cillion

      Hi guys!

      Im trying to filter a portal on the parent layout where I have 3 global fields. Now its just the one projectname who is working as needed.

      The Function and industy is valuelists, if it is easier to do evalate it to that?!

       

      My portal filter is now looking like this;

       

      Case (

        // ------- DISPLAY ALL

        IsEmpty ( Parent::projectname ) and

        IsEmpty ( Parent::Industry ) and

        IsEmpty ( Parent::Function ) ;

        1 ;

       

       

        // ------- DISPLAY Industry

        IsEmpty ( Parent::projectname ) and

        IsEmpty ( Parent::Function );

        PatternCount ( Project::Industry ; Parent::Industry );

       

       

        // ------- DISPLAY Function

        IsEmpty ( Parent::projectname ) and

        IsEmpty ( Parent::IndustriGroupID );

        PatternCount ( Project::Function ; Parent::Function );

       

       

        // ------- DISPLAY Name

        IsEmpty ( Parent::IndustriGroupID ) and

        IsEmpty ( Parent::FunctionAreaID );

        PatternCount ( Project::Name ; Parent::projectname );

       

       

        // ------- DISPLAY Industry AND Function AND Name

        PatternCount ( Project::Industry ; Parent::Industry ) and

        PatternCount ( Project::Name ; Parent::projectname ) and

        PatternCount ( Project::Function ; Parent::Function )

       

      )

        • 1. Re: Filtering portal with 3 global fields
          user19752

          "If spcefied use it as filter, otherwise show all" can be

           

          IsEmpty ( Parent::global ) or PatternCount ( Child::aField ; Parent::global )

           

          then concatenate similar calculation for all globals using "and".

           

          But, your calculation looks using more parent global fields than 3 child fields??

          • 2. Re: Filtering portal with 3 global fields
            cillion

            Thanks for your answer Im really new to this, do you have an example?

            "If spcefied use it as filter, otherwise show all" can be

             

            IsEmpty ( Parent::global ) or PatternCount ( Child::aField ; Parent::global )

            So in my example its will be? : 

            Case (

              // ------- DISPLAY ALL

              IsEmpty ( Parent::projectname ) or PatternCount( Project::name ; Parent::projectname)

              IsEmpty ( Parent::Industry ) or PatternCount( Project::Industry ; Parent::Industry)

              IsEmpty ( Parent::Function ) or PatternCount( Project::Function; Parent::Function) ;

              1 ;

             

             

              // ------- DISPLAY Industry

              IsEmpty ( Parent::projectname ) and

              IsEmpty ( Parent::Function );

              PatternCount ( Project::Industry ; Parent::Industry );

             

             

              // ------- DISPLAY Function

              IsEmpty ( Parent::projectname ) and

              IsEmpty ( Parent::IndustriGroupID );

              PatternCount ( Project::Function ; Parent::Function );

             

             

              // ------- DISPLAY Name

              IsEmpty ( Parent::IndustriGroupID ) and

              IsEmpty ( Parent::FunctionAreaID );

              PatternCount ( Project::Name ; Parent::projectname );

             

            then concatenate similar calculation for all globals using "and".

             

            But, your calculation looks using more parent global fields than 3 child fields??

             

              // ------- DISPLAY Industry AND Function AND Name

              PatternCount ( Project::Industry ; Parent::Industry ) and

              PatternCount ( Project::Name ; Parent::projectname ) and

              PatternCount ( Project::Function ; Parent::Function )

            )

            • 3. Re: Filtering portal with 3 global fields
              cillion

              Is this what you mean?

              • 4. Re: Filtering portal with 3 global fields
                user19752

                I meant you wrote

                  IsEmpty ( Parent::IndustriGroupID ) and

                  IsEmpty ( Parent::FunctionAreaID );

                Why these are ..ID?

                • 5. Re: Filtering portal with 3 global fields
                  cillion

                  No it is those is parent::industry and parent::function, I just forgot the change them, sorry. This is my script for filtering this portal now at this point:

                  Ps! Project is the child table

                   

                  Case (

                    // ------- DISPLAY ALL

                    IsEmpty ( Parent::projectname ) or PatternCount( Project::name ; Parent::projectname)

                    IsEmpty ( Parent::Industry ) or PatternCount( Project::Industry ; Parent::Industry)

                    IsEmpty ( Parent::Function ) or PatternCount( Project::Function; Parent::Function) ;

                    1 ;

                   

                   

                    // ------- DISPLAY Industry

                    IsEmpty ( Parent::projectname ) and

                    IsEmpty ( Parent::Function );

                    PatternCount ( Project::Industry ; Parent::Industry );

                   

                   

                    // ------- DISPLAY Function

                    IsEmpty ( Parent::projectname ) and

                    IsEmpty ( Parent::Industry );

                    PatternCount ( Project::Function ; Parent::Function );

                   

                   

                    // ------- DISPLAY Name

                    IsEmpty ( Parent::Industry ) and

                    IsEmpty ( Parent::Function );

                    PatternCount ( Project::Name ; Parent::projectname );



                    // ------- DISPLAY Industry AND Function AND Name

                    PatternCount ( Project::Industry ; Parent::Industry ) and

                    PatternCount ( Project::Name ; Parent::projectname ) and

                    PatternCount ( Project::Function ; Parent::Function )

                  )

                  • 6. Re: Filtering portal with 3 global fields
                    user19752

                    Combine 3 condtions

                     

                    ( IsEmpty ( Parent::projectname ) or PatternCount( Project::name ; Parent::projectname) )

                    and

                    ( IsEmpty ( Parent::Industry ) or PatternCount( Project::Industry ; Parent::Industry) )

                    and

                    ( IsEmpty ( Parent::Function ) or PatternCount( Project::Function; Parent::Function) )

                    • 7. Re: Filtering portal with 3 global fields
                      cillion

                      Wow! I removed the Case() function and just used the combining of the 3 condition as you posten, and it is woring perfectly Updating after selection a new value also

                      Only downside of this, is that when selecting "1" in the global industry search term, the portal is showing 1 and 10 and 11, and not only the "1"

                      • 8. Re: Filtering portal with 3 global fields
                        cillion

                        Is there a way to make it only show the select value for the two dropdown globals?

                        • 9. Re: Filtering portal with 3 global fields
                          user19752

                          If you need only exact match, using = instead of PatternCount() show only 1, but you may need partial match for (at least) projectname.

                          If you want word match, add spaces to values like

                          PatternCount ( " " & Project::Function & " " ; " " & Parent::Function & " " )

                          will decrease unwanted match.

                          • 10. Re: Filtering portal with 3 global fields
                            cillion

                            Okey, for both the Industry and Function is a dropdown. In my case will that be like this:

                            ( IsEmpty ( Parent::projectname ) or PatternCount( Project::name ; Parent::projectname) )

                            and

                            ( IsEmpty ( Parent::Industry ) or PatternCount( " " & Project::Industry & " " ;" " & Parent::Industry & " " ) )

                            and

                            ( IsEmpty ( Parent::Function ) or PatternCount( " " & Project::Function & " ";" " & Parent::Function & " " ) )

                            • 11. Re: Filtering portal with 3 global fields
                              cillion

                              This worked for exact filter on two of the dropdowns:

                              ( IsEmpty ( Parent::projectname ) or PatternCount( Project::name ; Parent::projectname) )

                              and

                              ( IsEmpty ( Parent::Industry ) or PatternCount( " " & Project::Industry & " " ;" " & Parent::Industry & " " ) )

                              and

                              ( IsEmpty ( Parent::Function ) or PatternCount( " " & Project::Function & " ";" " & Parent::Function & " " ) )