Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

frustrated filter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    frustrated filter

    I need to filter a page based upon user login (user_name). have had some help from steve wood in this link

    http://msgboard.alphasoftware.com/al...ht=filter+page

    but i cant seem to get this to work.

    i have a table = tmembership
    in the table a field = user_name

    security setup and imported from table = tmembership. mapped the fields;

    userid (security) = user_name (tmembership)
    password (security) = password (tmembership)

    all i want to do is to restrict the record based upon the user logged in.

    i have tried steves suggestions as per link above - but doesnt seem to work (i must be doing something wrong)

    i tried the following

    Code:
    DBF.filter = "userID = " + quote(session.__protected__UserID)
    which i got from the help file.

    i then tried adding these 3 lines form the help file (i think the help file should provide a breakdown of each part of the line of code (ie what each part pertains to). i changed the names i thought were applicable to my DB.

    Code:
    level = lookup("[PathAlias.ADB_Path]\tmembership", "user_name=" + quote(user_name), "level")
    session.__protected__SecurityLevel = level
    session.__protected__UserID = lookup("[PathAlias.ADB_Path]\tmembership", "user_name=" + quote(user_name), "UserID")
    but i receive an error saying can not find variable 'user_name'

    this doesnt make much sense to me.

    i also tried another filter provided by the forum

    Code:
    DBF.filter = "user_name = '"+ session.userid + "'")
    this was missing a parenthesis so i added one before the word 'session' again no joy. this just gave me all records.

    i need help!!!!!!!

    richard

    #2
    Re: frustrated filter

    Richard,

    You are very close.

    The help assumes you have configured security to put the ulink value in a session variable named session.__protected__UserId. The attached picture, screen1, shows security configured this way. If you have named you session varable differently, change the name in your filter accordingly.

    Here's a snippet of code that filters one of my components:

    Code:
     
    <%A5
    '==== start Ev_MyRegs component ====
    Delete tmpl_Ev_MyRegs
    DIM tmpl_Ev_MyRegs as P
    tmpl_Ev_MyRegs = a5w_load_component("Ev_MyRegs")
    with tmpl_Ev_MyRegs
     componentName = "Ev_MyRegs"
     .DBF.filter="Ev_Active .and. Pe_Id ="+quote(session.__protected__UserID)
    end with
    Here, I'm filtering for only records that that have table field Ev_Active=.t. and have field Pe_Id = the session variable that results from login.

    Pat
    Pat Bremkamp
    MindKicks Consulting

    Comment


      #3
      Re: frustrated filter

      hi Pat,

      thanks for your help. i still seem to be having a problem

      what i have done so far, is set the web security to receive a value and set this as user_name from my table tmembership.

      in customize options i have set the following

      enable external user id = true
      session var for ID field = userid

      i did define an argument in a component which i set as _protected_userid

      the line of code for the page is

      Code:
      .DBF.filter="user_name ="+quote(session.__protected__Userid)
      i am getting an error saying that the variable user_name is not found, i changed to userid, but still not found. tried all sorts of variations with user_name and userid

      tried to follow the help files.

      where am i going wrong?

      thanks

      richard

      Comment


        #4
        Re: frustrated filter

        Hi Richard,

        I know next to nothing regarding this but did notice a discrepancy.

        i did define an argument in a component which i set as _protected_userid

        the line of code for the page is

        Code:
        .DBF.filter="user_name ="+quote(session.__protected__Userid)i
        You have single underscores in your arguement definition and double underscores in your filter. Unless just a typo in your message.
        Mike
        __________________________________________
        It is only when we forget all our learning that we begin to know.
        It's not what you look at that matters, it's what you see.
        Henry David Thoreau
        __________________________________________



        Comment


          #5
          Re: frustrated filter

          Richard,

          You said that you set up the session variable to hold the identifier field as userid. Therefore, when you refer to it in a script, you need to refer to it as session.userid. Ths is not the same as session.__protected__userid, they are two different variables.

          Also, in your filter, user_name should be a field in your table that you are comparing to the value in the session variable. You said the error was it couldn't find a variable named user_name, which makes me wonder. Is the component based on a table or a view?

          Pat
          Pat Bremkamp
          MindKicks Consulting

          Comment


            #6
            Re: frustrated filter

            Hi Pat,

            the component is based upon the table (i have no views, very simple DB just 2 tables with no relation).

            i did pursue steve Woods idea of defining an argument and filtering in the component directly. i had to take out the alltrim to get it to work, but it has worked perfectly.

            im very new to this, so i am not sure if this way will satisfy all my filtering needs or if i will have to work out the filtering by page. hopefully the former now i seem to have it working.

            thanks for your help, very much appreciated.

            regards

            richard

            Comment

            Working...
            X