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

Must I otherwise somehow declare 'window.myvar' as global to make it global?

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

    Must I otherwise somehow declare 'window.myvar' as global to make it global?

    So, I have an application (panel) with the standard (UX) login, and an embedded object (panel application) which merely gets a community from a dropdown box of them. I need to store, as global variables I assume, both the username from the login and the community from the dropdown. Working first just with the community, I am able to store it in window.community, which I immediately test with an alert box showing the correct community. So far so good.

    Once the user selects the community from the list, he will click a button which takes the user to another panel which does, among other things, create a record including an address, a description and a photo. This record becomes one in a database. All that works just fine. I need to use the previously chosen community name (and username, but I'm not trying to do that now, just doing one thing at a time...) in the database record as well, but when I try to use it, even just display it in an alert box, it has no value. Other posts suggest that I need to DIM GLOBAL the window.community everywhere it is used - or rather those variables that are declared as DIM GLOBAL need to be so declared everywhere. It seems that using window.community (and hopefully window.myusername soon) gets around that necessity. Am I missing something? I have read the excellent CSDA tips section on this (Variable Usage, Dimensioning & Deletion (Email Comments) Updated 07 November 2011) but I'm not seeing an answer there. I have seen the M43 video (Understanding Global Javascript Variables and the 'Window' Namespace) which is why I thought to use the Window namespace but it does not go far enough to answer my question, it seems :)

    There are many pieces to this, it seems, but nothing comprehensive that I have found to help me understand the what-seems-to-me-to-be-simple method(s) to be able to pass a couple of variables from panel to panel! Any help would be appreciated.

    #2
    Re: Must I otherwise somehow declare 'window.myvar' as global to make it global?

    Hi Simonjm,

    I have similar application and I am declaring the Global Variable in the Web Project itself (WebProject Control Panel --> Project Properties -- > Application Global Variables). You can then give the Global variable any value from your function and whenever you use the Global Variable it will have the latest Value.

    Hope it works for you.

    Pevisha

    Comment


      #3
      Re: Must I otherwise somehow declare 'window.myvar' as global to make it global?

      My requirement was little different.
      I needed to store the value on the each device (-not by user, and not application wide global, but by device), so that when the user re-starts the application later the previous saved value on the device is to be used if saved before.
      (This is like say having a bank application that lets you save your login Id, so next time you do not have to enter login Id - just the password.)
      In my case the system wide global did not work as all users may see the same value, unless you have one unique global variable for each user.
      I used the local storage localStorage. Example: window.localStorage.last_saved_login (worked fine on iOS and Android mobile devices, also worked on PC). Thanks.

      Comment


        #4
        Re: Must I otherwise somehow declare 'window.myvar' as global to make it global?

        Thanks, Pevisha, I'll give it a try, although to be honest that was the first method I tried. It seemed from documentation and forum discussion that the Global Variables in Project Properties were being treated more like they were defined as constants, meaning you could use them throughout the application with the single value with which they started but could not be updated once the app started. Hope I'm wrong and it sounds like it works for you...

        Thanks, JP (or should I call you Mob?); that is actually something my users have asked for, a way to persist the login for an extended period of time, and I did not see a way to that on their (Android) phones. I'd be very interested to see how exactly you're doing that...

        Comment


          #5
          Re: Must I otherwise somehow declare 'window.myvar' as global to make it global?

          Hey call me anything.
          I am using this persistent variable on the device just to save the value of the last login person, [if the person clicks a "save login Id" button -actually it's a on/off button]. Next time anyone uses that device it just reads that persistent value from the device and updates the login Id field. Users has to enter password each time.
          If no value found in this persistent variable, the field is left blank on the UX.

          There is no persistent login in my logic. I think that is more of the Alpha app server setup. May be someone else may help!
          Sorry.
          Thanks!!

          Comment


            #6
            Re: Must I otherwise somehow declare 'window.myvar' as global to make it global?

            Hi,

            I have been using the Global Application Variables in my application and yes, it does have it's down fall. I am fairly new to Alpha and I am still learning about it. I am not entirely sure, but it seems to me like when you are using Global Variables, you need to be online. (I am developing a mobile Application and I was trying to test if I could get it to work with out wifi connection). Also, it feels like trying to get values from Global Variable somehow slows the application down (it maybe because, it has to connect to server?).

            So, I have an application which takes in about 25 values from the users and computes it to generate a report. There are a lot of loops and arrays going on. I wanted to know if there is a way to have declare Global Variables just for the particular application for the session (almost like how you declare variables before main function in java to make it Global).

            I have a lot of functions and they all require the same values from the user but at different instances and that was the reason, I used Application Global Variable but now, when I am testing it, it seems like it is making my app very slow.

            Any suggestions?

            Thanks Guys!

            Pevisha

            Comment


              #7
              Re: Must I otherwise somehow declare 'window.myvar' as global to make it global?

              Well, Pevisha, I'm a new guy doing this, too. (Started in 2010 but the project I was working was abandoned soon, so I stopped doing Alpha until this year again.) I have extensive web experience, DBA (Oracle, MS and MySQL flavors) and VB6/VBA experience, but Alpha Five/AA V12 is being much more complicated than any/all that, right now for me, at least :)

              I do know though that currently your app does have to be able to connect to the server to work, although there is a very recently announced beta version of AA12 that is designed to work through that problem (I'm guessing through a store-and-forward technique, but that is just a guess - I have not downloaded it yet; that is something I will need for my app, though, and I can't see why 99% of apps would NOT want that feature.

              I WILL work through this "using variables" mess for my app and will definitely share my results on this board.

              Comment


                #8
                Re: Must I otherwise somehow declare 'window.myvar' as global to make it global?

                Thanks Simonjm!

                Really appreciate it!

                Pevisha

                Comment


                  #9
                  Re: Must I otherwise somehow declare 'window.myvar' as global to make it global?

                  Here is a cut and paste from my cheat-sheet. Thanks!
                  Various UX javascript variables temporary and permanent variables defined

                  1) {dialog.object}
                  if (typeof {dialog.object}.__anyname1 == "undefined")
                  {{dialog.object}.__anyname1 = -1;}

                  2) window
                  if (typeof window.anyname2 == "undefined")
                  {window.anyname2 = -1;}

                  3) stateInfo
                  {dialog.object}.stateInfo['anyname3'] = 'yes';
                  To access the value of state variables
                  var x = {dialog.object}.stateInfo.anyname3
                  alert(x);

                  4) session variables
                  a) Properties panel of the UX under the Other > Published session variable option - add the following
                  SESSION.ANYNAME4
                  b) On Server Side onDialogInitialize add the following
                  SESSION.ANYNAME4 = "TEST"
                  c) On a button - use AJAX to update the value
                  function serverside_123 as c (e as p)
                  SESSION.ANYNAME4 = "TEST2" ...
                  d) Noticed that any update on the server will not update the same session variable on the client (Javascript cannot access the updated value on the server unless)
                  e) To update the workaround is [see http://msgboard.alphasoftware.com/al...ion+variables]
                  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

                  5) Persistent Storage
                  Use localStorage on the local device (iPhone, etc)
                  window.localStorage.anyname5 = 'TEST1' - Persistent Storage on the device and can be accessed by javascript easily. Device cleans up if set as temporary.

                  6) And Of course, if nothing else create a SQL table on the database with all the required fields [or two fields a) Variable_name b) Variable_value)], update them whenever required, access them whenever required.

                  Comment


                    #10
                    Re: Must I otherwise somehow declare 'window.myvar' as global to make it global?

                    Hi JP,

                    Thanks for your cheat sheet! I think using local Storage is going to be the best option.

                    Pevisha

                    Comment

                    Working...
                    X