6 Replies Latest reply on Aug 9, 2017 6:13 AM by johnw54

    hide fields

    johnw54

      I'm trying to hide a field based upon the AccountPrivilegeSetName.  If the account is [full access] or [wholesale users] I want the field to display.  Others it should hide the field.

       

      Get ( AccountPrivilegeSetName ) ≠ "[Full Access]"      this works fine..... but I need to add another. 

       

      When I try

       

      Get ( AccountPrivilegeSetName ) ≠ "[Full Access]" and Get ( AccountPrivilegeSetName ) ≠ "[Wholesale Users]"  the program crashes.  I'm sure I'm doing something wrong.

       

      Any suggestions would be helpful.

       

      Thank you.

        • 1. Re: hide fields
          beverly

          Try a "Case"

          Case (

          Get ( AccountPrivilegeSetName ) = "[Full Access]" ; 0 ;

          Get ( AccountPrivilegeSetName ) = "[Wholesale Users]" ; 0 ;

          1 // default to HIDE if the others are not above )

           

          This is flexible for you to add more "false" tests as needed. Otherwise it will be "true" and HIDE the object.

          Beverly

          • 2. Re: hide fields
            RickWhitelaw

            Try using or instead of and. A user can't be both full access and a wholesale user no?

            • 3. Re: hide fields
              philmodjunk

              What you have posted shouldn't crash the program. I'd look for other causes such as a damaged file. Try recovering it to see what is reported by the recover process.

               

              I do question the [ ] used with the Wholesale Users privilege set name. That won't be correct unless you explicitly entered those brackets as part of the privilege set name. Only the built in [Full Access] privilege set normally has those brackets.

              • 4. Re: hide fields
                johnw54

                Thank you.... when I did a recovery nothing showed up as a problem.  I also put the brackets around the [Wholesale Users] privilege set.  I knew pretty much nothing when I started programming so I just copied the [Full Access]. 

                 

                My problem is solved with

                 

                Get ( AccountPrivilegeSetName ) = "[Retail Users]" or Get ( AccountName )   =   "Store"

                 

                However the application still crashes in Layout mode.  This button is part of a button bar and the code above is attached to the Hide Object When property in the inspector. 

                 

                Not sure what the issue is

                • 5. Re: hide fields
                  beverly

                  My first thought, too, and then opted for the flexiblitly of the Case() - easier to add other conditions to NOT hide the object.

                  • 6. Re: hide fields
                    johnw54

                    Thank you

                     

                    Sent from my iPad