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

Calculated field and or Variable

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

    #16
    Re: Calculated field and or Variable

    Correct, Allen.

    Basic Concepts and Terminology
    There can be only one.

    Comment


      #17
      Re: Calculated field and or Variable

      Originally posted by preston View Post
      .....So you are saying I should have stated it here as vn_V-Items ? I thought the "V-Items AS N" made it clear it was a number variable. Am I still missing something?
      If you look at the variable right there near where it is declared, it's pretty obvious. But if you encounter (and try to use) this variable elsewhere on the form, (or as your code grows) you could easily make the mistake of thinking V-Items is the name of an item (type C) and not an amount.

      Plus, as Allen stated (wasn't thinking as I never used the hyphen) alpha is going to run into problems "thinking" you're trying to subtract the value of "items" from the value "V". (to Alpha, your variable "V-Items" looks like two separate variables. (upon which it will try to perform a mathematical calculation, in this case subtraction)

      For your variable, I personally would use a prefix of vnx_ (vnx_ItemsTOT, or vnx_ItemTOT, vnx_ItemsTotal, or vnx_ItemTotal etc.) which reflects the field you are actually calculating). ~Whenever I define calculated field variable, I always add an x to designate it as such, as it reminds me of the xy on the Alpha toolbar)

      NOTE: While you can also specify variable scope (vn, vns, vng etc.) for instant recognition, there is one caveat. If you later realize you made an error in scope definition and need fix it.... All your code may run fine, but the variables will incorrectly reflect the original designated scope when the variable was first named.
      Last edited by SNusa; 02-01-2012, 01:27 PM.
      Robert T. ~ "I enjoy manipulating data... just not my data."
      It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
      RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

      Comment


        #18
        Re: Calculated field and or Variable

        Originally posted by Allen Klimeck View Post
        You should not be using a "-" in your variable name. Alpha will think that you wish to subtract a variable "Items" from a variable "V"

        Allen

        Declaring a Variable
        Got it.

        Comment


          #19
          Re: Calculated field and or Variable

          Hi Preston,
          Looking at your invoice form, I see that first the customer is purchasing the garments, then for the garments, the print charges must be calculated and added to the invoice. I see the need for both a Purchase Order and a Work Order.

          So why not use a separate 'wo_chgs' table (can link to the P/O) to calculate these additional amounts which can then be added to the price of the garments? In your example there are both light and dark garment colors. Isn't it possible that the first garment group will have different print options than the 2nd? And you mention the location where the printing is to be put (weren't those choices: front, back, left and right?) that must also be specified. So somewhere in this process, it seems that a work order must be involved that puts all this detail forth. And that work order is where the heavy lifting can be done for calculating these charges which are then added to the invoice.

          In my example below 65 garments are purchased & printed: all the employees at Big Daddy's get polo shirts with a logo printed on the front, but only 15 of them want the l/s shirts with the logo on the back. And only 20 want the hoodies that have printing on the front and a logo on the right sleeve. I was not sure whether you would add the garments together to get the 1st print location, or only if the print job was the same - so I separated some which may be using different colors for light vs dark colored garments.
          Attached Files
          Last edited by MoGrace; 02-01-2012, 02:04 PM.
          Robin

          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

          Comment


            #20
            Re: Calculated field and or Variable

            This is a late response to your initial question. (how to get calculated field into a variable)

            Here's how: http://msgboard.alphasoftware.com/al...l=1#post598439

            Code:
            vc_vxyTotals = calculated_field_get(local_variables(),"vxyTotals").VALUE_GET()
            [COLOR="#0000CD"]' (where vxyTotals is the calculated field on form)[/COLOR]
            Robert T. ~ "I enjoy manipulating data... just not my data."
            It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
            RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

            Comment


              #21
              Re: Calculated field and or Variable

              Originally posted by SNusa View Post
              This is a late response to your initial question. (how to get calculated field into a variable)

              Here's how: http://msgboard.alphasoftware.com/al...l=1#post598439

              Code:
              vc_vxyTotals = calculated_field_get(local_variables(),"vxyTotals").VALUE_GET()
              [COLOR="#0000CD"]' (where vxyTotals is the calculated field on form)[/COLOR]
              Ok, let me see if I follow this.

              Lets say I have a calculated field named "Items" on a form thats calculated result is a number.

              I would get the calculated field results into a variable named "vn_items" to use in Xbasic by using the following.

              Code:
              dim vn_Items as n
              vn_Items = calculated_field_get(local_variables(),"Items").VALUE_GET()

              Comment


                #22
                Re: Calculated field and or Variable

                Originally posted by preston View Post
                Ok, let me see if I follow this.

                Lets say I have a calculated field named "Items" on a form thats calculated result is a number.

                I would get the calculated field results into a variable named "vn_items" to use in Xbasic by using the following.

                Code:
                dim vn_Items as n
                vn_Items = calculated_field_get(local_variables(),"Items").VALUE_GET()
                Yep, providing items is of type N here......... Click here: ==> CALCULATED_FIELD_GET Function

                It's located in the Wiki under Functions (above)
                Last edited by SNusa; 02-13-2012, 09:55 PM.
                Robert T. ~ "I enjoy manipulating data... just not my data."
                It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
                RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

                Comment


                  #23
                  Re: Calculated field and or Variable

                  Originally posted by SNusa View Post

                  Thanks Robert for clarifying that for me. I had already studied the calculated_filed_get function on Wiki along with all the aspects such as the "local_variables" function before I posted message 21. It just takes me awhile to grasp where I need to substitute my real world stuff in place of some of the things in examples. But I am learning more and more each day.

                  Comment


                    #24
                    Re: Calculated field and or Variable

                    Originally posted by preston View Post
                    Thanks Robert for clarifying that for me. I had already studied the calculated_filed_get function on Wiki along with all the aspects such as the "local_variables" function before I posted message 21. It just takes me awhile to grasp where I need to substitute my real world stuff in place of some of the things in examples. But I am learning more and more each day.
                    Me too. I actually reinforce my present knowledge of a5 by watching and responding to other threads (of common interest) here on the forum. Glad I could help. (Learning a5 is a daunting task at first. But at some point, everything just "begins to click!") ~My best suggestion to you would be to categorize all your subscribed threads here into folders, thus creating your own forum "go-to list." ~ It makes a good starting point, at least!

                    I'm actually more comfortable with writing basic X-basic code today than I am at "planting form controls." ~ Good notes on hundreds of hours of online training. (and a few reference books of years gone by) ~I now just use the Genies (Action Scripting) for reference if I get stuck coding.... ("I view the X-basic code, and make mine work")

                    IMHO, beyond becoming comfortable with the GUI (and understanding database setup).... Core X-basic, Object References, Pointers, Where to look in Wiki, (and then knowing what pitfalls to avoid from the get-go) is "The Key To a5!"

                    I don't know if this indicates which side of the ("gifted" <---> "challenged") slider scale I'm personally on: But it took me nearly a two month commitment of "hard-core" (8+ hours /day) of intense involvement to pull it all together.... Now I just need some "seasoning"..... At present, it may take me 3x the time as a "seasoned pro", but I think I can now do almost anything with a5, and do it well..... (at least on the desktop side) ~ Learn the desktop and core X-basic first ~ then the web will come "easy!"
                    Last edited by SNusa; 02-13-2012, 10:43 PM.
                    Robert T. ~ "I enjoy manipulating data... just not my data."
                    It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
                    RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

                    Comment

                    Working...
                    X