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 Variable - Exactly what gets the published Session Variable to by browser

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

    Session Variable - Exactly what gets the published Session Variable to by browser

    I was able to publish a session variable in UX by defining adding it to the Properties panel of the UX under the Other > Published session variable option where I added say (just one line):
    SESSION.MYVARIABLE
    Now I have a server side xbasic function (AJAX) that sets/updates the value of the session variable when I click on a button (first button).
    SESSION.MYVARIABLE = time()
    Question: What gets the updated value of the session variable on the server update/sync the session variable on the session variable on the client side?

    I have another button (second button) that runs javascript code on the client.
    None of this worked on the client side button - it does not show the new value
    alert(" session variable value 1 = " + {dialog.object}.getSessionVariable("MYVARIABLE"));
    alert(" session variable value 2 = " + {dialog.object}.getSessionVariable("SESSION.MYVARIABLE"));
    alert(" session variable value 3 = " + SESSION.MYVARIABLE);

    [I know it does get updated on the server when I click the first button (AJAX) as I can see the value of the session variable being updated each time I click the button, when I run a page with ?a5w_info() and view its value there]
    Thanks!
    Last edited by JPMPA; 07-16-2014, 03:13 PM.

    #2
    Re: Session Variable - Exactly what gets the published Session Variable to by browser

    Are they [Published Session variable on Server and Session Variable on Client] not always in sync? My javascript on the client in a button does not show the latest value of the session variable on the server...
    alert(" session variable value 1 = " + {dialog.object}.getSessionVariable("MYVARIABLE")); Help!

    Comment


      #3
      Re: Session Variable - Exactly what gets the published Session Variable to by browser

      Did you initialize the session variable before calling your UX? You should probably give it a starting value before opening the UX. But, in my opinion, the only time session variables are useful are when they are set at login time and then remain constant throughout the connection.

      Comment


        #4
        Re: Session Variable - Exactly what gets the published Session Variable to by browser

        No, I was/am not sure how to initialize the session variable, before calling the UX component. Because there is only one UX component and nothing is called before that. Can you initialize it on the Properties panel of the UX under the Other > Published session variable option where I added: Is the following valid?
        SESSION.MYVARIABLE="no_time" ???
        Thanks!

        Comment


          #5
          Re: Session Variable - Exactly what gets the published Session Variable to by browser

          do you have dialog.initialize event in version 12 may be you can set the variable in that or dialog execute function as
          Session.myVariable = "something"
          thanks for reading

          gandhi

          version 11 3381 - 4096
          mysql backend
          http://www.alphawebprogramming.blogspot.com
          [email protected]
          Skype:[email protected]
          1 914 924 5171

          Comment


            #6
            Re: Session Variable - Exactly what gets the published Session Variable to by browser

            Gandhi, I am able to initialize the session side variable in the onDialogInitialize function now. But any updates to the session variable on the server using AJAX are just "not" updating the same session variable values on the client. May be I am expecting too much from the session variable? Thanks.

            Comment


              #7
              Re: Session Variable - Exactly what gets the published Session Variable to by browser

              JPMPA, you can do what GGandhi suggest to set the session variable in the dialog server-side event, "onDialogInitialize".

              It won't work in Working Preview, you will have run under browser to see that part work. That's one big reason not to use session variables - you have to put in special code that emulates them in Working Preview. Recent pre-release updates include some good info in the server side events for emulating session variables - at least the grids do anyway.

              Changing the session variable in a callback is not as straight forward as initializing it in onDialogInitialize. I cannot remember if javascript has to be emitted from the callback to do the set or if there is some property deep in the "e" object that you can change.

              See video M58 (stateInfo object) for an alternative to session variables. Until this morning I was very excited about the stateInfo object. Now I am finding out it will be tough to use the stateInfo object when there could be multiple instances of a component open, like in a tabbed-ui. The tough part, for me, is that the client-side conditional style expression doesn't work well with the stateInfo object - it is hard to code the expressions to refer to the intended grid object.

              Comment


                #8
                Re: Session Variable - Exactly what gets the published Session Variable to by browser

                Code:
                session.myVariable = "gandhi"
                e.javascript = "alert('the session.myVaribale is "+session.myVariable+"');"
                place this in the onDialogInitialize event

                place a button and in the onClick Event call an xbasic function (mine is called setNew) and place this in that function
                Code:
                session.MyVariable = "Jackie"
                setNew = "alert('the current session variable is "+session.myVariable+"');"
                then preview may need some more fine tuning to do what you want.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                  #9
                  Re: Session Variable - Exactly what gets the published Session Variable to by browser

                  Gandhi, I do not wish to get the session variable from the server using the AJAX (or xbasic function) each time as the above setNew example [the above example actually does not even get the session variable - it just gets the "value" of the session variable to the javascript]- I need to update it there on the server using AJAX but then use the local Javascript session variable in my local javascript code. Thanks!

                  I bet if you have a button with the following javascript (no AJAX)
                  alert(" session variable is = " + {dialog.object}.getSessionVariable("MYVARIABLE"));
                  It will show just "gandhi" before and also after onClick Event call an xbasic function (setNew). "Jackie" will not show.
                  The local SESSION.MYVARIABLE is not updating to "Jackie", although the server SESSION.MYVARIABLE did get updated.
                  I am trying to see what will sync these two.
                  Really appreciate you time.
                  Last edited by JPMPA; 07-16-2014, 09:20 PM. Reason: Corrected on javascript instead of SESSION.MYVARIABLE used {dialog.object}.getSessionVariable("MYVARIABLE"))

                  Comment


                    #10
                    Re: Session Variable - Exactly what gets the published Session Variable to by browser

                    Gandhi,
                    Yes, that would make the changed session variable show up in the alert, but that is not quite the same as having the client-side session variable actually contain that value.

                    I think he is looking for something like this in the callback xbasic function:

                    dim currTime as c
                    currTime = TIME()
                    dim js as c
                    js = js_escape("{dialog.object}._vars.SESSION.MYVARIABLE = " + quote(currTime) + ";")
                    your_callback_function_name = js

                    Comment


                      #11
                      Re: Session Variable - Exactly what gets the published Session Variable to by browser

                      http://screencast.com/t/av7sBnWWkwgd
                      I am not sure, but session variable is seen in the dialog after publishing.
                      (unless there is something I don't understand)

                      sorry, I do not have mic in this computer.
                      thanks for reading

                      gandhi

                      version 11 3381 - 4096
                      mysql backend
                      http://www.alphawebprogramming.blogspot.com
                      [email protected]
                      Skype:[email protected]
                      1 914 924 5171

                      Comment


                        #12
                        Re: Session Variable - Exactly what gets the published Session Variable to by browser

                        Rich/Gandhi, seems like the session variables may not be right choice for the work i am doing in this particular case.
                        I will just use a global javascript variable or window.myvariable and let the AJAX emit the update statement to this at end of its logic.
                        Example: setNew = "window.myvariable = " + whateverservervalueorcalculations + ";"
                        This as the last AJAX statement- then use window.myvariable as I want without additional trips to server.
                        When need to update again - will call AJAX again...
                        Rich - I liked your code and is helpful.
                        Thanks!

                        Comment


                          #13
                          Re: Session Variable - Exactly what gets the published Session Variable to by browser

                          just want to say, sorry I was on wrong page.
                          I always considered session variables along with server but you are looking for the functionality making it available to the client.
                          I did not connect.
                          thanks for reading

                          gandhi

                          version 11 3381 - 4096
                          mysql backend
                          http://www.alphawebprogramming.blogspot.com
                          [email protected]
                          Skype:[email protected]
                          1 914 924 5171

                          Comment


                            #14
                            Re: Session Variable - Exactly what gets the published Session Variable to by browser

                            Gandhi, Sorry I was hoping to use the session variable as the one way 'live' conduit between the server and the client, but apparently I did convey that correctly. Now understand that nothing is 'live' but has to be updated explicitly from the server using AJAX or other means that requires a round trip. The discussion did help me understand the process more. Appreciate your time. Thanks!

                            Comment

                            Working...
                            X