1 Reply Latest reply on Mar 10, 2011 9:46 AM by philmodjunk

    Condtional Statement Not Evaluating Properly



      Condtional Statement Not Evaluating Properly


      I'm running a script that looks at various groups or Privilege Sets that I created to group various departments in my organization. This basically is a on load script that will run to only display records for the individual's group that they belong to. I have an if statement that goes:

      If Get ( AccountPrivilegeSetName) <> "[Full Access]" or
      Get ( AccountPrivilegeSetName) <> "Admin Staff"

      Perform Find [Restore]

      End If

      When I run this script as a user who belongs to either of the two groups listed in the conditional, it still proceeds as if the statement is true meaning, [Full Access] will try to preform the find. I don't know why this statement is not working properly.

      If any of this is confusing I can try to explain it better with screen shots. Thank you.

        • 1. Re: Condtional Statement Not Evaluating Properly

          First, think through your expression. If a person with [Full Access] logs in,

          Get ( AccountPrivilegeSetName) <> "[Full Access]" will be false, but:

          Get ( AccountPrivilegeSetName) <> "Admin Staff" will be true. Thus this simplifies to True Or False which in turn evaluates to true and the find is performed. If you work this through with "Admin Staff" then you also get a true result as the first part of the expression will be true.

          Change OR to AND in your rexpression and then your script will perform the way you want it to.


          As you have discovered, you can't enter a calculation expression as criteria for a manual find and have it evaluate. This can be done with scripted finds either with the variable as you mention or by using set field steps. I prefer set field as this lists the criteria in the script in a way that doesn't require double clicking the Perform Find step just to see the criteria used.

          Enter Find Mode[] //clear the pause check box
          Set Field [Table1::Group ; Get ( AccountPreivilegeSetname ) ]
          Set Error capture [on]
          Perform Find []