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

Clear session variable without ending session?

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

  • Clear session variable without ending session?

    I use a lot of session variables to filter data in components that are opened from another component. I worry that this may bog down the browser by taking up its memory. I would like to know if that is true. And, if so, is there a way to clear out the session variables used to filter a component when that filtered component is closed, WITHOUT ending the user's session? Thank you.
    Carol King
    Developer of Custom Homebuilders' Solutions (CHS)
    http://www.CHSBuilderSoftware.com

  • #2
    Re: Clear session variable without ending session?

    https://www.alphasoftware.com/docume...e%20Method.xml

    does this help?
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

    Comment


    • #3
      Re: Clear session variable without ending session?

      That looks promising. Leaving on trip and won't be able to try until Monday. Wonder if I need to use that function in an xbasic callback?
      Carol King
      Developer of Custom Homebuilders' Solutions (CHS)
      http://www.CHSBuilderSoftware.com

      Comment


      • #4
        Re: Clear session variable without ending session?

        it is an xbasic function, so i would imagine that is the way to do. since the sessions are in the server, xbasic will set it the way you want it. setting and removing.
        thanks for reading

        gandhi

        version 11 3381 - 4096
        mysql backend
        http://www.alphawebprogramming.blogspot.com
        ggandhi344@gmail.com
        Skype:ggandhi344@gmail.com
        1 914 924 5171

        Comment


        • #5
          Re: Clear session variable without ending session?

          I wonder if too many session variables can affect browser speed and performance? If so, then I will pursue trying to get them removed when no longer needed (using the method you suggest).
          Carol King
          Developer of Custom Homebuilders' Solutions (CHS)
          http://www.CHSBuilderSoftware.com

          Comment


          • #6
            Re: Clear session variable without ending session?

            Sorry... have to ask... Gandhi... did you test what you posted?

            Establishing a Session Variable in, for example, the onDialogInitialize event of a UX...

            Code:
            session.mytest1 = "sessionTest1"
            session.mytest2 = "sessionTest2"
            And then setting up 2 XBasic functions, each being called from a button on the UX...

            {dialog.Object}.ajaxCallback('','','removeSessionVars','');
            {dialog.Object}.ajaxCallback('','','testSessionVars','');

            Code:
            function removeSessionVars as c (e as p)
            	
            debug(1)
            
            Context.Session.Remove(session.mytest1)
            delete session.mytest2
            	
            end function
            Code:
            function testSessionVars as c (e as p)
            
            debug(1)
            
            dim s1 as c
            dim s2 as c
            
            s1 = session.mytest1
            s2 = session.mytest2
            	
            end function
            The result is that s1 is set with the value of session.mytest1. session.mytest1 is still a valid session variable.
            s2 results in an error because session.mytest2 has been deleted.

            Carol, I believe what you're looking for is delete.

            Gandhi, try the above and see if you get the same or different results.

            Comment


            • #7
              Re: Clear session variable without ending session?

              Originally posted by kingcarol View Post
              I wonder if too many session variables can affect browser speed and performance? If so, then I will pursue trying to get them removed when no longer needed (using the method you suggest).
              I'd guess you'd have to quantify "too many". 1,000? 10,000? 50?

              Comment


              • #8
                Re: Clear session variable without ending session?

                David, you have an error in your Xbasic. The parameter passed into the Remove method should be the name of the variable to remove, not the variable itself.
                Code:
                Context.Session.Remove(session.mytest1)
                should be
                Code:
                Context.Session.Remove("mytest1")
                When used correctly, Context.Session.Remove() and delete are equivalent.

                Lenny Forziati
                Vice President, Internet Products and Technical Services
                Alpha Software Corporation

                Comment


                • #9
                  Re: Clear session variable without ending session?

                  Excellent... thanks Lenny...

                  Comment


                  • #10
                    Re: Clear session variable without ending session?

                    Originally posted by Davidk View Post
                    I'd guess you'd have to quantify "too many". 1,000? 10,000? 50?
                    I can only guess, but probably at least 1,000. But, in general, I want to know if session variables can affect performance at all?
                    Carol King
                    Developer of Custom Homebuilders' Solutions (CHS)
                    http://www.CHSBuilderSoftware.com

                    Comment


                    • #11
                      Re: Clear session variable without ending session?

                      Thank you, Lenny, David, and Gandhi. I'll try it Monday. In general, Is it a good practice to remove session variables when component filtered to them is closed, and they are no longer needed?
                      Carol King
                      Developer of Custom Homebuilders' Solutions (CHS)
                      http://www.CHSBuilderSoftware.com

                      Comment


                      • #12
                        Re: Clear session variable without ending session?

                        Carol, if you are going to the conference, perhaps you could ask Selwyn and the rest of the developers how to program without using Session variables to pass data around from one component to the next at both the client (JavaScript) and server (xbasic) level. I posted the following sample application several years ago. I bet the AA engineers could redo this using better code and/or see where they could build in some more routines to help in this matter. This demonstrates most of the different situations where parameter passing needs to be done (and can be done) without sessions vars:

                        https://www.alphasoftware.com/alphaf...d-Lookup-Grids

                        If your app uses a tabbedUI then session variables may get fowled up between different instances of a component being opened in different tabs. I admit there are still places in my code where I use session variables (whose values change after login, based on selected record), and at some point I will eliminate them. For anything new I write, I avoid changing the value of session variables after the user has made it through the login process. After I know who is signing into the app, I asked them what dataset they want to use (which sets several session variables), and if they have multiple roles in the selected dataset, I ask them what user role (my "role" definition; not an AA Security Role) they want to use for that session (which sets a few more sessions vars).

                        I also, really worry about Alpha Session variables when it comes to a user opening the web app in two different instances of the browser or in two different browser tabs.
                        For example, when the user tries to go to my login page in another tab, I have the following in the xbasic code block at the top of the a5w page:

                        Code:
                        if variable_exists("session.SOME_VARIABLE")
                        	response.redirect("ERR_MULTI_SESSIOINS_NOT_ALLOWED.a5w")
                        	end
                        end if
                        When the user clicks "Logout" link, I direct them to an a5w page that records the exit date/time in the DB and then clears out the session vars with this bit of code:

                        Code:
                        A5WS_LogoutUser( )
                        Context.Response.Clear()  '** Not sure if this is necessary, maybe it is something for IIS
                        session.clear()	 '** This is required to clear the session variables.
                        If a new browser tab can "see" the session variables from a different browser tab then it proves to me that you cannot rely on the session variables to always have the expected value. If you can copy the session variable value to a local variable for that component when the component is first opened and always use the copied value then you might be okay. But then there is the big problem about knowing if a cached version (cached from different browser tab) of the component was used instead of reloading it from the server. I turn all component caching off, but what if I miss doing that for some component or if in the AA builders you run across a place where that option is not available?

                        P.S. 1,000 session vars is an awful lot. How do you even manage giving them unique names? If you are looking at performance issues, I would look at client-side conditional formatting - they can add a whole lot of processing time. I have a component that cannot be run on Safari because the client-side conditionals take so much time to execute on Safari. I think the alternative is to go with client-side templating and local CSS classes such that the data includes something to do with what CSS class name should be added to an element. Also, another, not so drastic measure, is to have your own JavaScript code set and remove CSS classes from elements.

                        -Rich Fulham
                        Last edited by RichCPT; 10-25-2017, 01:53 PM. Reason: Clarification: I am not concerned with session vars whose values are constant throughout the session.

                        Comment


                        • #13
                          Re: Clear session variable without ending session?

                          Originally posted by Davidk View Post
                          Sorry... have to ask... Gandhi... did you test what you posted?

                          Establishing a Session Variable in, for example, the onDialogInitialize event of a UX...

                          Code:
                          session.mytest1 = "sessionTest1"
                          session.mytest2 = "sessionTest2"
                          And then setting up 2 XBasic functions, each being called from a button on the UX...

                          {dialog.Object}.ajaxCallback('','','removeSessionVars','');
                          {dialog.Object}.ajaxCallback('','','testSessionVars','');

                          Code:
                          function removeSessionVars as c (e as p)
                          	
                          debug(1)
                          
                          Context.Session.Remove(session.mytest1)
                          delete session.mytest2
                          	
                          end function
                          Code:
                          function testSessionVars as c (e as p)
                          
                          debug(1)
                          
                          dim s1 as c
                          dim s2 as c
                          
                          s1 = session.mytest1
                          s2 = session.mytest2
                          	
                          end function
                          The result is that s1 is set with the value of session.mytest1. session.mytest1 is still a valid session variable.
                          s2 results in an error because session.mytest2 has been deleted.

                          Carol, I believe what you're looking for is delete.

                          Gandhi, try the above and see if you get the same or different results.
                          So you are all set david?
                          Sorry have to ask make sure you are okay.
                          thanks for reading

                          gandhi

                          version 11 3381 - 4096
                          mysql backend
                          http://www.alphawebprogramming.blogspot.com
                          ggandhi344@gmail.com
                          Skype:ggandhi344@gmail.com
                          1 914 924 5171

                          Comment

                          Working...
                          X