Alpha Video Training
Results 1 to 3 of 3

Thread: "is_one_of()" question

  1. #1
    Member
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    988

    Default "is_one_of()" question

    Hello,

    I have searched the forum without success.

    I need to set my filter based on a user having two groups assigned to their user id.

    So for example a user is a member of "Administrators" and "Power Users". How would i specify more than one group in my filter below?

    filter = "(Company_Id= \""+sCompany_id+"\"" .OR. is_one_of(\"Administrators\",sGroups)) .AND. left(Lastupdate,4) <> \"TEMP\""

    Thanks,

    Denis

  2. #2
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Re: "is_one_of()" question

    if sGroups contains a list of the groups the logged in user belongs to, then it would just be this:

    ...is_one_of(\"Administrators\",sGroups) .or. is_one_of(\"PowerUsers\",sGroups)...

    I get the value of your sGroups like this:

    sGroups = crlf_to_comma(a5ws_get_user_assignments(session.__protected__ulink,request))
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  3. #3
    Member
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    988

    Default Re: "is_one_of()" question

    Thank you Steve.

    I am now trying to incorporate your example within my a5w page (containing a dialog component).

    In my a5w page I have inserted this (red) to filter the dropdown by company_id or if Administrators then show all.

    I have also inserted similar code (Green) for a second dropdown which works with just the company_id filter.

    I can therefore conclude that the problem is with the security group filter.

    Code:
    with tmpl
    componentName = "dlg_epw_report"
    sGroups = crlf_to_comma(a5ws_get_user_assignments(session.__protected__ulink,request))
    with tmpl.Variable_Info[1]
    .DropDownBox.Filter = "Company_Id=" +quote(session.__protected__company_id) .OR. is_one_of(\"Administrators\",sGroups) .or. is_one_of(\"PowerUsers\",sGroups)	
    with tmpl.Variable_Info[2]
    .DropDownBox.Filter = "Company_Id=" +quote(session.__protected__company_id)
    end with 
    end with 
    end with
    I get this error when the a5w page loads.

    500 Internal Server Error
    "Script Error
    Error:Script: /EPW/dlg_epw_report.a5w line:45
    .DropDownBox.Filter = "Company_Id=" +quote(session.__protected__company_id) .O
    Argument is incorrect data type"


    Can anyone see where I have gone wrong? I just need the dropdown to filter by the company_id unless the user is an Administrator, then show all.

    Denis

Similar Threads

  1. "Field Display Formatting" is Lost when "Pre-fetch data for Detailed View = Active"
    By PhillipS in forum Application Server Version 9 - Web/Browser Applications
    Replies: 0
    Last Post: 07-23-2009, 11:02 PM
  2. ms access "views" vs. dbf "sets" question
    By er2fan in forum Application Server Version 9 - Web/Browser Applications
    Replies: 5
    Last Post: 07-03-2009, 05:47 PM
  3. form.view("fName","","","center","center")
    By reynolditpi in forum Alpha Five Version 9 - Desktop Applications
    Replies: 5
    Last Post: 07-15-2008, 12:37 AM
  4. To "zoom to record" or to "open form" using action scripting, that is the question.
    By georgefurnel in forum Alpha Five Version 9 - Desktop Applications
    Replies: 4
    Last Post: 06-18-2008, 07:32 PM
  5. "Add" and "Save" buttons don't stay on "Self" page
    By Scholin in forum Application Server Version 8
    Replies: 2
    Last Post: 02-05-2008, 08:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •