New call-to-action
Results 1 to 23 of 23

Thread: filter web app HELP!!!!!!!!!!!

  1. #1
    Member
    Real Name
    eric e
    Join Date
    Feb 2009
    Posts
    15

    Default filter web app HELP!!!!!!!!!!!

    I tried asking this other ways and not getting any help to resolve it so I am trying another way
    I want clients to login on the web and get filtered to there information only
    Is there a setting in the security to do the filtering or is it done by the component
    what would the variable be.

  2. #2
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,096

    Default Re: filter web app HELP!!!!!!!!!!!

    hi eric,

    i can help you here (its not often i can help others), the variable is set from the login using the ulink value in the web security set up. you would set the ulink value to a unique id field in your table

    then in the web component in the query tab, click 'define arguments' and create a 'session variable'.

    name - give it a name
    data type - character
    get argument value from - session variable
    variable - click elipsis, add variable, give it a name, and select type as 'session'

    you have now defined your argument, now you need to set your filter

    in the filter field enter

    'database_field_with_unique_id_value=(:your_session_variable_as_created_above)'

    when you user logs on and selects a page with this component in, only those records which meet the value you have filtered will show.

    i hope i have this right, im sure someone will help if not.

  3. #3
    Member
    Real Name
    Scott Segrin
    Join Date
    Feb 2009
    Location
    Germantown, WI
    Posts
    25

    Default Re: filter web app HELP!!!!!!!!!!!

    Hi Eric:

    I'm certainly no expert at this, but I think my setup is similar to what you are asking about. I have a grid component for a table that has a Username field. I filter the table (and thus the grid) based on the userid at login.

    Here's how it works:

    At the very top of my login.a5w page I have this code...

    <%a5
    if eval_valid("submitbutton")
    if eval_valid("userid")
    dim session.__protected__userid as c
    session.__protected__userid = userid
    end if
    end if
    %>

    [This was based on a suggestion from another post. I'm unclear as to why it goes at the top or what it even does - doesn't make sense - but this is working for me.]

    Then in my grid component on the Query (DBF) screen, I have an Argument ("Define Argument" button) with the following settings:

    Name: varname (Whatever variable name you want to use)
    Data Type: Character
    Get argument value from: Get value from variable
    Variable: userid (Session Variable)

    For that last part, you need to go into another dialog box, add a new variable, give it the name "userid" and set "Scope" to "Session Variable".

    After you have created the Argument, go in to Filter box and enter the following:

    Username := varname

    "Username" is the name of the field in the table you want to filter. "varname" is the variable name you created in the first step. My understanding is that you must have the colon before the equal sign to indicate that varname is an argument and not any other type of variable.

    I think that's it. Hope this helps.

  4. #4
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,096

    Default Re: filter web app HELP!!!!!!!!!!!

    hi eric, scott,

    you don't need to set the code at the top of each page (im not sure if there is an advantage to doing this) but i have no code in my pages as the sessions variable is set when the user logs in and doesn't need to be set again.

    the argument in your components filter the grids based upon the session variable.

    you just need to make sure your ulink value is set to the field in your table which will filter the records (this is in the web security settings, under 'customize options' > 'session variable for identifier field')

  5. #5
    Member
    Real Name
    eric e
    Join Date
    Feb 2009
    Posts
    15

    Default Re: filter web app HELP!!!!!!!!!!!

    hay thanks for the help I have been trying for days to get some where

    but I do a couple questions about it

    (define) - security settings
    I clicked the Enable external user identifier field to get the Session variable for indentifier field do I need to add name from the query tab
    "image attached"

    in the Define Arguments there was not a option for get argument value from "session variable"
    "image attached"

    last question in the filter I tried to plug in database_field_with_unique_id_value="client"
    "image attached"

    thanks

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

    Default Re: filter web app HELP!!!!!!!!!!!

    Eric - Scott and Richard are describing two methods to place some ID -- representing the logged in user -- into a variable for filtering records. Scott's solution places the Username into that variable, the value the user enters as their username when they log in. This is a common solution because it is easy to envision using that username as a field in the table you want to filter.

    Richards solution uses the "ulink" value from Security Framework. That takes some reading up on Security Framework before you start. This is a more rigerous solution since Security Framework ENSURES that value will be present in the session variable as long as that person is logged in (not true with the previous solution). Another advantage is that this ulink value is arbitrary and unique; it still represents the user even if they change their Username. But it can take more work to establish this ulink value IF you want to do it dynamically from your website. But if you are creating all of your users yourself, you can create any value for the ulink, as long as it is unique.

    Scott - the code doesn't have to go at the top, but being there ensures it will fire when the Submit button is pressed. The reason it works is that the login dialog has a field named userid where the user types their login value. It just sets it to that session variable IF the submit button is pressed (and not before).
    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)

  7. #7
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,096

    Default Re: filter web app HELP!!!!!!!!!!!

    eric,

    images 2 and 3 you have right, the first, you need to change the name to the field in your table which will uniquely identify the record you want to filter to,

    for example mine is a field in my table called 'caseref' which is an autoincrement field and i also called my session variable caseref

    so my filter is

    Code:
    caseref=(:caseref)
    hope this makes sense

  8. #8
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,096

    Default Re: filter web app HELP!!!!!!!!!!!

    ps - took me some time to understand and get right and thanks to steve for all his help with this.

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

    Default Re: filter web app HELP!!!!!!!!!!!

    If you accept my advice, all three images show improper methods.

    Image 3: the variable should be named __protected__ulink. The word "ulink" is optional, you can call it client if you want to, but the __protected__ part is MANDATORY. (That's double-underscore "protected" double-underscore. Without going in to details let me say I can hack your security if you use a non-protected variable here. "Ulink" is a good choice for the suffix because that's what this value is. It's not a clientID or anything else related to the users role, it's the unique identifier for the logged in user, which could be a client, or could be YOU.

    Image 2: Then entry would be __protected__ulink.

    Image 1: Per above, the entry would be database_field_with_unique_id_value=:ulink assuming you named the argument "ulink".

    Also, your database_field... variable name is too long, especially if that is your common practice. There are places within Alpha where a variable name will be truncated. I'm thinking of Component Names which truncate to 15 in the A5W page, but it is safer to keep all variable names shorter.
    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)

  10. #10
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,096

    Default Re: filter web app HELP!!!!!!!!!!!

    Also, your database_field... variable name is too long, especially if that is your common practice. There are places within Alpha where a variable name will be truncated. I'm thinking of Component Names which truncate to 15 in the A5W page, but it is safer to keep all variable names shorter.
    sorry, this is what i meant by image 1 being incorrect. the field name was just copied from my first post above.

  11. #11
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,096

    Default Re: filter web app HELP!!!!!!!!!!!

    i hadnt used protected in mine, i should adopt this method.

    this is why i thought they were ok.

  12. #12
    Member
    Real Name
    eric e
    Join Date
    Feb 2009
    Posts
    15

    Default Re: filter web app HELP!!!!!!!!!!!

    hay richard

    thanks for the help and being unstanding
    but I still not getting it
    I took the name from my table
    (see image table.jpg)

    I changed the filter setting
    (see image filter_field.jpg)

    security settings
    (see image security.jpg)

    it is allowing me to login but it is pulling 1 job that does not even connect to the client id

    could it be my login I have the clint attached to a group and using the Abreviato (client id) for the group id

    example:
    group "ABC" the abc is the Abreviato or client id
    Client "abc@abc.com"

    once thanks for the help

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

    Default Re: filter web app HELP!!!!!!!!!!!

    Like I said in my first post, you need to study Security Framework in the Help documentation to get this. You are mixing Group ID with Ulink, at a minimum. Also, please read my last post with very important advice on this.
    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)

  14. #14
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,096

    Default Re: filter web app HELP!!!!!!!!!!!

    eric,

    apart from steves advice, which you should follow, you have exactly what i use so far.

    you may not have completed the final step which is taken when you add the users, if you are importing them from a table, then you need to choose values in the web security table against those in your table

    for example, username, password, email address and ulink

    you need to set the ulink field to get the value from your abreviato field in your table.

    if you are adding the users one at a time then you need to set the value of your 'abreviato' field in the field 'external user id'.

    im not sure how you have added users so far, go to web security > users and groups, and then either 'import' or 'add user'


    i hope this helps, but if not just let me know.

  15. #15
    Member
    Real Name
    eric e
    Join Date
    Feb 2009
    Posts
    15

    Default Re: filter web app HELP!!!!!!!!!!!

    Richard

    I set up users in the web security using add user then I named the group the same name that is located in the table under the aberviato.

    Users :user1
    Groups :abc

    then I assigned the user to a group

    I am just little confused for the fact how does it connect to the group
    how does it know to look in the abervito line for "abc" matching the groups name

    I did more reading last night I just dont see were the connection is that will complete it so thanks for the help



    eric

  16. #16
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,096

    Default Re: filter web app HELP!!!!!!!!!!!

    eric,

    its not so much the groups (these can be used to define permissions for users.

    go back to your users section of the web security, choose a user and select 'edit user'

    at the bottom of this screen there is a field called 'external user id', enter in to this field the value of your abreviato field for this record.

    this is the value that is used as a session variable and then this is the value that your components will filter records on.

    don't worry about, it took me such a long time to get my head round it and there are no step by step instructions anywhere.

    i got a lot of help from steve and once i understood it then it was pretty easy from there on.

    hope this helps

  17. #17
    Member
    Real Name
    eric e
    Join Date
    Feb 2009
    Posts
    15

    Default Re: filter web app HELP!!!!!!!!!!!

    Richard

    you are the man thanks a lot that was the final piece
    now that I seen how to do it, it does seem easy it would be nice if was explained in the help file like this simple step by step

    again thanks for the support

    eric

  18. #18
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,096

    Default Re: filter web app HELP!!!!!!!!!!!

    your welcome, glad i could help someone.

    dont forget to follow steves advice using 'protected__'

  19. #19
    Member
    Real Name
    Anis Fakhoury
    Join Date
    Jun 2000
    Posts
    513

    Default Re: filter web app HELP!!!!!!!!!!!

    If the database that needs to be filtered doesn't have the userid field, the database is completely independent from the login userid, how can I assign records from the database to a specific user ?

    do we have to create another table with the userID and link it to those records in the independent database ? I have thousands of accounts and each user is authorized to see his 5 or 6 accounts. The managers would see all accounts for example.

  20. #20
    Member NicholasWieland's Avatar
    Real Name
    Nicholas Wieland
    Join Date
    Apr 2008
    Location
    Huntington, NY
    Posts
    546

    Default Re: filter web app HELP!!!!!!!!!!!

    Anis,

    You are correct.
    Create a user table have the uulink field and say customeracct
    #, maybe a parent number field and filter based on the login through the customeracct# from the webuser table.

    Then you have to place this a5 code on a header or all the pages to be filtered something like this:
    IF eval_valid("session.__protected__ulink")
    IF session.__protected__ulink <> "" THEN
    session.custname = alltrim(lookupc("F",alltrim(session.__protected__ulink),"Companynumber","[PathAlias.ADB_Path]\users","ID"))
    END IF
    ELSE
    ? "<a href=\"Login.a5w\">Login</a> "
    END IF
    Nicholas Wieland
    LedgerSuite.com Corp
    nnw@edfi.net
    http://www.ledgersuite.com


  21. #21
    Member
    Real Name
    Anis Fakhoury
    Join Date
    Jun 2000
    Posts
    513

    Default Re: filter web app HELP!!!!!!!!!!!

    Thanks Nicholas but I'm a bit confused.
    If I have a database that has fileds like Account, buys,sells,total
    Example A12345,06,09,15

    I will create a webuser table that has userid, password,Account
    Then I will link the Account in the webuser table to the Account field in the database.
    where would the UULINK field come from, which table ?

  22. #22
    Member NicholasWieland's Avatar
    Real Name
    Nicholas Wieland
    Join Date
    Apr 2008
    Location
    Huntington, NY
    Posts
    546

    Default Re: filter web app HELP!!!!!!!!!!!

    Quote Originally Posted by Anis View Post
    I will create a webuser table that has userid, password,Account
    Then I will link the Account in the webuser table to the Account field in the database.
    where would the UULINK field come from, which table ?
    Do a search on"Web Application Functions" in help and review

    ? A5WS_Get_GUID_From_User("alfred")
    = "d2756e91632942ac93472e5423f0de58"

    ?a5ws_Get_Ulink_From_GUID("432f3df278a24df0a39219be1f356019")
    = "00000029"


    dim guid as C
    guid = A5WS_Get_GUID_From_User("doris")

    ? guid = "9036155807a2443782ba61ed2a974471"

    ? A5WS_Get_User_From_GUID(guid)
    = doris



    You can create an update to your user table and update it with the guid to a ulink field, then set a session variable to query your table.
    Nicholas Wieland
    LedgerSuite.com Corp
    nnw@edfi.net
    http://www.ledgersuite.com


  23. #23
    Member
    Real Name
    Anis Fakhoury
    Join Date
    Jun 2000
    Posts
    513

    Default Re: filter web app HELP!!!!!!!!!!!

    Thank you Nicholas. That is very helpful

Similar Threads

  1. Guidance for new web app
    By Kzin in forum Application Server Version 9 - Web/Browser Applications
    Replies: 6
    Last Post: 04-17-2009, 03:57 AM
  2. Moving MS Access destop App to Web App built in Alpha Five v9
    By Richard Rabins in forum Announcements
    Replies: 0
    Last Post: 12-18-2008, 09:45 PM
  3. Desktop app to web app?
    By Huey in forum Alpha Five Version 7
    Replies: 1
    Last Post: 03-19-2006, 08:02 PM
  4. Web App Question
    By afreeland in forum Web Application Server v6
    Replies: 1
    Last Post: 02-27-2006, 08:46 PM
  5. Converting your APP to a Web App
    By Dave Wilson in forum Alpha Five Version 6
    Replies: 4
    Last Post: 09-22-2004, 10:13 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
  •