4 Replies Latest reply on Jan 24, 2014 10:45 AM by Annette

    Pattern Count?? for Hide feature

    Annette

      Title

      Pattern Count?? for Hide feature

      Post

           Hi, was looking for some help on a script for the hide feature in the new FM13,  

           I have  field which is a checkbox using a value list I created.  

           When I look up that field on a table then I see each of the items checked in a list, great.  

           I've created a variable of that field.

           What i'm trying to do is hide a button if the variable doesn't contain a certain word...so I was using the following script but am getting errors:

           If (not (PatternCount ($$Variable ; "Word")))

           What am I doing wrong?  

        • 1. Re: Pattern Count?? for Hide feature
          philmodjunk

               I suggest:

               Not IsEmpty ( FilterValues ( CheckboxFieldHere ; "Word" ) )

               This will be True when "Word" is a value selected in your set of check boxes. Patterncount can be used instead, but due to the way it works, it can produce "false positive" results with some combinations of value list values and "word" values.

               Example:

               PatternCount ( List ( "AppleSauce" ; "Salad" ; "French Fries ) ; "Apple" )  will return a True result even though "Apple" is not a member of the list of values. FilterValues avoids this issue.

               and I'd put

               Not IsEmpty ( FilterValues ( YourTable::CheckboxFieldHere ; "Word" ) )

               Right in the Hide When box. no scripting should then be needed.

          • 2. Re: Pattern Count?? for Hide feature
            Annette

                 Does that still work if I replace the field with the Variable that i made of that field (I made it a variable because I use it multiple times for different things within the database, its found from the account users info).

            • 3. Re: Pattern Count?? for Hide feature
              philmodjunk

                   If you set the variable to the value of your check box field, yes.

              • 4. Re: Pattern Count?? for Hide feature
                Annette

                     Thanks Phil, it wasn't working for me at first which is why I questioned it, then realized I was actually doing the formula the wrong way around.....working now!  I was naming the word which I wanted it to show for .........duh