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

Filter records by userid field

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

    Filter records by userid field

    I have a grid where I am trying to get records to
    show where a field in a contacts table = userid shows only records
    that = to the email address logged on as userid.

    eg if logged on as [email protected] then only records in the table contacts
    that contain [email protected] in field userid will show.

    If in Events BeforeValidateExistingRecord I use

    function BeforeValidateExistingRecords as v (DataSubmitted as P, Args as p, PageVariables as p)
    with PageVariables
    DataSubmitted.UserID = session.__protected__userid
    end with
    end function

    On preview I get an error
    500 Internal Server Error
    "Script Error
    Error:Script: /LivePreview/Grid_Contacts2_LivePreview.a5w line:20
    x_out = a5w_run_Component(tmpl) 'SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE
    Symbol multiply defined"

    If the line DataSubmitted.UserID = session.__protected__userid is omitted
    on preview the grid runs normally.

    Any ideas please?
    Thanks
    John

    #2
    Re: Filter records by userid field

    Suddenly I see it. You are running this in LivePreview. Security it totally absent in LivePreview. You have to test it fully published to the localhost and log in, etc. session.__protected__userid won't exist in LivePreview.

    Error:Script: /LivePreview/Grid_Contacts2_LivePreview.a5w line:20
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: Filter records by userid field

      Thanks Steve
      I ran this via the localhost and recieved this message.
      500 Internal Server Error
      "Script Error
      Error:Script: /threerivers/3RContacts2.a5w line:38
      x_Grid_Contacts2 = a5w_run_Component(tmpl_Grid_Contacts2) 'SYSTEM GENERATED CO
      Symbol multiply defined"

      The url shows
      http://localhost:8080/threerivers/3R...58b432be7d194e

      Comment


        #4
        Re: Filter records by userid field

        If you search on 'Symbol multiply defined', others show what the promlem might be. if you cant figure it out, attach the grid and the a5w page here for someone to evaluate.
        Steve Wood
        See my profile on IADN

        Comment


          #5
          Re: Filter records by userid field

          Thanks Steve
          Will come back to this.

          Comment


            #6
            Re: Filter records by userid field

            As Steve suggests I am attaching the Grid and the page containing the Grid. NB I get an error on the grid alone as well as on the page.
            Perhaps someone can throw some light on this.
            Thanks
            John

            Comment


              #7
              Re: Filter records by userid field

              Before Validate Event in your grid you have below

              function BeforeValidateExistingRecords as v (DataSubmitted as P, Args as p, PageVariables as p)
              with PageVariables
              DataSubmitted.UserID = session.__protected__userid

              end with
              end function

              The line DataSubmitted.UserID = session.__protected__userid
              you dont have a field called UserID in your grid.
              I'm pretty sure means you cant use it.
              If you have a field in your table called userid great! Then add it to the fields list, hide the row and change the property to a hidden field.
              Then you can use the DataSubmitted.UserID = session.__protected__userid

              Also I am not sure why this is in this event.
              I would probably have it in can insert and or can update events.

              Chad
              Chad Brown

              Comment


                #8
                Re: Filter records by userid field

                Thanks Chad,
                I am not at my machine at the moment but directly I get there I will get to it.

                The field is in the table, as an after addition so I reckon I maybe did not refresh the table with the little double arrow button on the Query.
                Regards
                John

                Comment


                  #9
                  Re: Filter records by userid field

                  Thanks Chad
                  I have checked and have userid in the table and in the grid now.
                  I have placed the line DataSubmitted.UserID = session.__protected__userid in Can update and CanInsertRecord as follows:

                  function CanInsertRecord as v (DataSubmitted as P, Args as p, PageVariables as p, Result as p)
                  with PageVariables
                  DataSubmitted.UserID = session.__protected__userid
                  Result.Cancel = .f.
                  Result.ErrorHTML = ""
                  end with
                  end function

                  However when I Live Preview the Grid all records show and if I logon with the correct userid all records show again.
                  I am attaching the latest grid maybe you can see where its going wrong.
                  Thanks
                  John

                  Comment


                    #10
                    Re: Filter records by userid field

                    Sorry I havent looked at the component yet but is there an argument set up for the filter?
                    Chad Brown

                    Comment


                      #11
                      Re: Filter records by userid field

                      John, I'm going to cut a short video on this. Is your userid the text they type in as their username when they log in, or something else? If so, how do you get the value they use to login, into that userid variable?
                      Steve Wood
                      See my profile on IADN

                      Comment


                        #12
                        Re: Filter records by userid field

                        Is your userid the text they type in as their username when they log in, or something else?
                        Yes the userid is the same as when they login


                        If so, how do you get the value they use to login, into that userid variable?
                        I did not realise more needs doing, I thought the login created this, so I am not clear on what else needs doing.

                        The video sounds really helpful and I am looking forward to seeing it.

                        Thanks
                        John

                        Comment


                          #13
                          Re: Filter records by userid field

                          Well, yes you are right, if you are using my Web Template (plug: found here), then it automatically puts the login username in that variable. If anyone else want to do this, you place this xbasic anywhere on the page that has your login dialog.

                          if eval_valid("submitbutton")
                          if eval_valid("userid")
                          dim session.__protected__userid as c
                          session.__protected__userid = userid
                          end if
                          end if
                          Steve Wood
                          See my profile on IADN

                          Comment


                            #14
                            Re: Filter records by userid field

                            Yes Steve I am using your Template so I wonder why this aspect does not seem to work for me?
                            FWIW to others, being new to A5, the Alphatogo template has been a godsend in helping me understand what goes on as well as being able to make faster progress.
                            Thanks for the Template Steve
                            John

                            Comment


                              #15
                              Re: Filter records by userid field

                              John, I'm going to cut a short video on this.
                              Hi Steve
                              I am still floundering on this and I wondered if you had made some progress with the video.
                              Thanks
                              John

                              Comment

                              Working...
                              X