No announcement yet.

WHERE IF Clause using global variable (security module)

  • Filter
  • Time
  • Show
Clear All
new posts

  • WHERE IF Clause using global variable (security module)

    I have a situation that I need to restrict viewing of specific records based on a user group from the security module. I used adz1111 advice (Thread - Security Module Application Access Validation) and captured the user group. There is also a field in the table that will determine if the record should not be viewed by all (publish = 0) or if it can be seen by all (publish = 1). I have added the following to the SQL Select Statement of the Grid Application:

    WHERE publish >= IF(('[ugroup]' != 'Administrator'),1,0)

    While this does work is this the best way to handle this type of requirement?

  • #2
    I don't know this kind of SQL statement. I would suggest that you do something like : where publish >= [glob_select];
    Then in the oninit event I would set the [glob_select] like

    {[glob_select]=1;} else {[glob_select]=0;}
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /


    • #3
      Thanks Albert,

      I like it better -- I put it in the menu onApplicationInit with the ugroup code that way I can keep all of the glob_vars together in one app. Much easier to troubleshoot and revise later.