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

session var cached on web page problem

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

    session var cached on web page problem

    I have a grid on an a5w page. The grid dynamically sets a session var by Ajax callback. Works great the first time. But on subsequent times it doesn't update the session var. It's cached. If I refresh the browser page and then do the callback all is well. So how do I get the session var to update each time on the Ajax callback w/o manually refreshing the page?
    Peter
    AlphaBase Solutions, LLC

    [email protected]
    https://www.alphabasesolutions.com



    #2
    Re: session var cached on weg page problem

    In what event are you setting the var?

    function OnGridExecute as v (e as p)
    'This event fires every time the Grid is run, including every Ajax callback.

    function OnGridInitialize as v (e as p)
    'This event fires when the Grid is initialized. It also fires when the Grid is
    're-initialized after a session has expired.
    'IMPORTANT: The onGridExecute event, which fires every time the Grid is executed fires BEFORE this event.

    Comment


      #3
      Re: session var cached on weg page problem

      David, from a button.
      Peter
      AlphaBase Solutions, LLC

      [email protected]
      https://www.alphabasesolutions.com


      Comment


        #4
        Re: session var cached on weg page problem

        Peter -

        Do I read this that you have one event on the grid, and another on a button to set the variable?

        Can you show us the line of code you're using to make the assignment(s)? I presume your button's code is in the Xbasic Functions section for the callback?
        -Steve
        sigpic

        Comment


          #5
          Re: session var cached on weg page problem

          So, the button is doing an Ajax Callback that is setting a session var? Then the var should be set each time that button is pressed. In Working Preview mode, does the code get executed each time?

          Comment


            #6
            Re: session var cached on weg page problem

            Originally posted by Davidk View Post
            So, the button is doing an Ajax Callback that is setting a session var? Then the var should be set each time that button is pressed. In Working Preview mode, does the code get executed each time?
            Yes, it updates in W.P. I use the session var which is passed into an argument in 2nd grid as a filter. Grid 1 the user enters in part#, clicks the button and opens grid2 which is filtered on part. Works 1st time fine. Close grid 2, enter a new part, click button, grid2 opens w. prev part#, not the last entered. But if I hit F5 in the browser first, then enter a new part, grid2 opens w. correct filter.
            Peter
            AlphaBase Solutions, LLC

            [email protected]
            https://www.alphabasesolutions.com


            Comment


              #7
              Re: session var cached on weg page problem

              we had an issue with a couple of grids in v11 where we were setting session variables in grid events using format e.rv.Session.myVar ="test"
              we changed the code to use Session.myVar="test" and it seemed to resolve the problem.
              another thing you could try is to output the session value to a file or a5w_info() page after the second update to see if the session variable has the expected value.
              https://appsbydesign.co.uk/

              Comment


                #8
                Re: session var cached on weg page problem

                I see the same behaviour but the 2nd Grid doesn't filter properly on the first opening, only subsequent refreshes. There are so many ways to set up this scenario and I'm not sure how you're opening grids etc., but since you're entering or selecting a Part # from a grid then I'll assume that Part # is a field in that grid. Grid 2 is filtered on that Part #. I don't know if you can use Action Javascript to Open a Grid Component, but it works. That particular dialog allows the entry of a filter - and this works every time.

                It seems that the session var is a timing issue.

                If you're using Action Javascript, then there's a setting to turn off using a cached grid. That solves part of my problem. The grid now opens the first time with the correct filter, but closing and opening again I am one variable behind. I don't have to refresh or go back to design, but the var is not updated right away.
                Last edited by Davidk; 01-19-2012, 11:42 AM.

                Comment


                  #9
                  Re: session var cached on weg page problem

                  Although this is not exactly the same issue, but telling the browser to never cache the page helped on one of my dillemas.

                  I had a problem with a page running some xbasic working fine the first time the page was called from a button on a grid but subsequent calls from the button didn't execute the script - just displayed the page. The cached page was not executing the a5 xbasic and added this code to the head section on the page

                  <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
                  Seemed to fix the problem for my page.
                  Land of the Free, Because of the Brave
                  Support our US Military

                  Comment


                    #10
                    Re: session var cached on weg page problem

                    Try the technique in video # 69 for passing data. I think you will find it works much better than relying on session variables.

                    http://www.ajaxvideotutorials.com/V1...dToAnother.swf

                    Comment


                      #11
                      Re: session var cached on weg page problem

                      <META HTTP-EQUIV="Pragma" CONTENT="no-cache">

                      Thanks for the reminder. Haven't tried Pragma-no-cache in a while. Does seem to do the trick.
                      Peter
                      AlphaBase Solutions, LLC

                      [email protected]
                      https://www.alphabasesolutions.com


                      Comment


                        #12
                        Re: session var cached on web page problem

                        I have hit the same wall. Big time. Session variables do seem to stick around, probably cached META tag in header didn't help either. Only refreshing the browser will refresh the session variables. Grrrrrrr.... So, [window] -approach it is (too bad since I followed Selwyn's video M41 to the tee and got excited about this cool bean until it turned out that caching kills it.) Grrrrrr..... Is there really no way to clear session variables between calls?

                        Comment


                          #13
                          Re: session var cached on web page problem

                          Still having a problem... Using the approach explained in http://www.ajaxvideotutorials.com/V1...dToAnother.swf, I can see that the window[var] is refreshed properly with each click of the parent form button. I can grab the value in the child grid with javascript. However, I also need to use that value in my xBasic code that does some filtering on the child grid, but I have no idea how to get to it with xBasic. I've wikid and googled and manualed for this, the cows have come home and gone out again, but still no answer... I assume there must be an xBasic function that can deal with the browser window object the same way as javascript does. Any ideas?

                          Comment


                            #14
                            Re: session var cached on web page problem

                            Yeah, it seems to depend upon the browser etc. I ended up using a filter passed to the a5w page. There are some links that might help you w. the session JS thing.

                            But have you looked at these JS methods?

                            {grid.Object}.gridBaseFilterSet(filterExpression, orderExpression, filterParameters)
                            {grid.Object}.gridFilterSet(filterExpression [, orderExpression [, filterParameters]])
                            Peter
                            AlphaBase Solutions, LLC

                            [email protected]
                            https://www.alphabasesolutions.com


                            Comment


                              #15
                              Re: session var cached on web page problem

                              That would certainly work for filtering, thanks!

                              My problem is a little different, however:

                              I call a child grid from a parent grid.
                              I pass a primary key from the parent grid to the child grid (again, session vars are unreliable when it comes to refreshing, so I use window -object to attach the PK to it and keep it around
                              I open the child grid, and when I click a button below the grid, I want the foreign key in the child grid's table to be populated with the PK coming from the parent grid

                              I've tried your hidden column technique to write the incoming PK into a calculated column on the child grid, but I must be doing something wrong because I can't get to that value with xBasic.

                              Here's (part of) my inGridRender JS:

                              Code:
                              // Establish event ID and event name variables
                              
                              var x_wvE_EVENTID = '';
                              var x_wvE_NAME = '';
                              
                              // Assign window[] variables passed from the parent grid to the child grid
                              
                              if(window['wvE_EVENTID']) x_wvE_EVENTID = window['wvE_EVENTID'];
                              else x_wvE_EVENTID = '-999';
                              
                              //write the Event ID value to a hidden calculated column in the grid
                              
                              {grid.Object}.setValue('G','GET_JS_VAR',rowNum,x_wvE_EVENTID);
                              Next up: click button below the grid. What should happen now is that the data behind the grid is refreshed with the ID (foreign key value from the parent to the grid data)

                              So I tried this in the button's OnClick event (xBasic):

                              Code:
                              vEventID = e._currentRowDataNew.GET_JS_VAR
                              However, e._currentRowDataNew is empty for some odd reason (as is e._currentRowDataOld) so my xBasic code can't get to the value I inserted in the grid.

                              This is a tough nut (for me, that is) and I'd sure like to move beyond it by now, 28 hours later...

                              Comment

                              Working...
                              X