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

Saving Global Variables

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

  • Saving Global Variables

    I have a database in which I store a number of global variables in the autoexec file, two are dates which I can calculate each time the script runs. However, I haven't figured out how to update the value stored in the autoexec file when I change the value in a form. Has anyone else done this? If so would you mind giving me some idea on how to accomplish this? Can you have a global variable table?

    The global variable holds an exchange rate value, so another way around this would be to capture the value I require from a financial site on the web each time I start the application, this would automatically be up to date each time the application started. Does anyone know if this is possible or has anyone done something similar? If so can you point me to the relevant section of the helpfile? As I have spent a long time searching and nothing so far!

  • #2
    Re: Saving Global Variables

    In response to your first question I suggest:

    http://www.learn alpha.com/BetterGlo...lVariables.htm

    Comment


    • #3
      Re: Saving Global Variables

      I think something similar to what you mention in the second part is discussed here.
      There can be only one.

      Comment


      • #4
        Re: Saving Global Variables

        Thanks both of you - great links!

        Comment


        • #5
          Re: Saving Global Variables

          I like defining them in a two field table holding variable name and variable value, and having a UDF generate them using evaluate_template() and eval() functions. I attached an example.
          Mike W
          __________________________
          "I rebel in at least small things to express to the world that I have not completely surrendered"

          Comment


          • #6
            Re: Saving Global Variables

            Thanks for this Mike! I will have a look later on.

            Comment


            • #7
              Re: Saving Global Variables

              I have got the first part of the global variables definitions working now, thanks to everyones help! However while doing this I came across another question, which I have resolved, however I was wondering if there was a better way?

              When declaring a date as a global variable, if I store the date as 07/10/2008 in the global variable table, the variable will not declare correctly! However, if I put the date in curly brackets {07/10/2008} it works fine. What I would like to know is if there is a way around this? e.g. I want to store 07/10/2008 in the field without having to manually enter the curly brackets each time and have the variable declare correctly.

              Has anyone done anything similar or is this just something I will have to put up with?

              Comment


              • #8
                Re: Saving Global Variables

                Just change the function like this if no other global variables will contain the forward slash.

                Code:
                IF "/" $ vSVV
                			vsVV = ctod(vsVV)
                			vdim = "dim global "+ alltrim(vSV) + " as D"
                			evaluate_template(vdim)
                			eval(vSV) = vSVV
                		ELSE
                			vdim = "dim global "+ alltrim(vSV) + " as C"
                			evaluate_template(vdim)
                			eval(vSV) = vSVV
                		END IF
                You could add a field for the variable type and incorporate that in the function. Would allow you to create all the variable types in the function.
                There can be only one.

                Comment


                • #9
                  Re: Saving Global Variables

                  Stan,

                  Can you explain the first line of the If statement code to me? I don't understand where the "/" $ comes in to it???

                  Comment


                  • #10
                    Re: Saving Global Variables

                    Stan, Its alright I've figured it now!!!

                    Comment


                    • #11
                      Re: Saving Global Variables

                      if I store the date as 07/10/2008 in the global variable table
                      The if decides if the value stored in the variables table is a date, how else (?), by looking for the forward slash in the text.
                      There can be only one.

                      Comment


                      • #12
                        Re: Saving Global Variables

                        Hi Stan,

                        Yes, I figured it out in the end, here's my resulting function:

                        FUNCTION udVars AS A (udTabName AS C )
                        t=table.open_session(udTabName,file_ro_shared)
                        t.fetch_first()
                        while .not. t.fetch_eof()
                        if "/" $ t.My_value then
                        evaluate_template("dim global "+trim(t.My_var)+" as "+trim(t.My_type))
                        evaluate_template(trim(t.My_var)+ "=" + "{" + trim(t.My_value) + "}")
                        else
                        evaluate_template("dim global "+trim(t.My_var)+" as "+trim(t.My_type))
                        evaluate_template(trim(t.My_var)+ "=" + trim(t.My_value))
                        end if
                        t.fetch_next()
                        end while
                        t.close()
                        end
                        END FUNCTION

                        My function uses slightly different code to yours, so it wouldn't accept the use of CTOD as the evaluate_template command will only take a string as an argument, but you pointed me in the right direction!

                        Thanks very much,

                        Alastair

                        Comment


                        • #13
                          Re: Saving Global Variables

                          Alastair,

                          I see a small problem with your code. If you have a global character string you want to define that contains a / then it looks like you code would fail. You might want to try the highlighted change since you already know that data type in the table.

                          Jeff

                          Code:
                          FUNCTION udVars AS A (udTabName AS C )
                          t=table.open_session(udTabName,file_ro_shared)
                          t.fetch_first()
                          while .not. t.fetch_eof()
                          [COLOR="Red"]if trim(t.My_type) $ "Dd" then[/COLOR]
                          evaluate_template("dim global "+trim(t.My_var)+" as "+trim(t.My_type))
                          evaluate_template(trim(t.My_var)+ "=" + "{" + trim(t.My_value) + "}")
                          else
                          evaluate_template("dim global "+trim(t.My_var)+" as "+trim(t.My_type))
                          evaluate_template(trim(t.My_var)+ "=" + trim(t.My_value))
                          end if
                          t.fetch_next()
                          end while
                          t.close()
                          end
                          END FUNCTION
                          Jeff Ryder

                          Comment


                          • #14
                            Re: Saving Global Variables

                            Jeff,

                            Yes, you are right, the My_Type field already holds the type of data so I don't need to test for "/" thanks for your suggestion!!

                            Comment


                            • #15
                              Re: Saving Global Variables

                              Hmmm. Great information, however, what if the field is an image you need to be global?
                              Kevin G. Timberlake
                              Marvel Illusions

                              Comment

                              Working...
                              X