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

Difference between references...

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

  • Difference between references...

    When writing xbasic within, say, an onchange event within a form... what is "the right way," to reference table field vs form field data? For example, what is the difference between the following two references:

    1) memberships->recur_dis_amt
    2) recur_dis_amt.value

    Thanks
    "all things should be as simple as possible... but no simpler"

    Mike

  • #2
    Re: Difference between references...

    As with many things, there is no right way.

    1) memberships->recur_dis_amt
    -refers to the value in the table field directly
    -changing this does not change what is displayed on the screen until the form is resynched to the table

    2) recur_dis_amt.value
    -refers to the value cited above when the record was painted on the screen
    -changing this does not affect the table until the change is saved.

    I think.
    There can be only one.

    Comment


    • #3
      Re: Difference between references...

      Originally posted by michaelwpayton View Post
      1) memberships->recur_dis_amt
      2) recur_dis_amt.value
      Thanks
      The arrow -> is a table pointer.
      The dot signifies what comes next is a subelement, in the case of a form it is a property of an object.

      Meg Ryan->eyes="blue" Means If you see Meg Ryan in person, you could see that she has blue eyes.
      People Magazine:Meg Ryan.eyes="blue" Means Meg Ryan's picture in People Magazine has blue eyes.

      Both are "right" ways. I prefer the former to the latter for obvious reasons (asides from the fact that I that wouldn't mind seeing her in person).
      Last edited by G Gabriel; 12-16-2008, 06:52 PM.

      Comment


      • #4
        Re: Difference between references...

        2) recur_dis_amt.value
        -refers to the value cited above when the record was painted on the screen
        -changing this does not affect the table until the change is saved.
        Stan, I think of this a bit differently. This expression refers to the "value" property of an object named "recur_dis_amt". The object name may or may not be the same as the corresponding field name in the table. Strictly speaking it's the name of the text box or other control, not the table field or variable to which the control is bound.

        Most such objects also have a "text" property, and the behavior of the "text" and "value" properties is slightly different from each other. The "text" property contains the string which appears in the display of the object even before the underlying record buffer has been updated. The "value" property contains the same information, but the "data type" is adjusted to match the data type of the field or variable to which the object is bound. IIRC, this "value" property is not available to your scripts until focus leaves the object.

        Comment


        • #5
          Re: Difference between references...

          Originally posted by Tom Cone Jr View Post
          Strictly speaking it's the name of the text box or other control, not the table field or variable to which the control is bound.
          Tom:
          Just to be a little nit-picking smart-Alec:
          "Controls" are used when referring to xdlg while "Objects" are used when referring to forms. Tomatoes and TOMATOES.

          Comment


          • #6
            Re: Difference between references...

            G., I take your point, and it's valid within the Alpha Five universe. More broadly speaking however, each of these "objects" is itself a "window", which Microsoft calls a control. -- tom

            Comment


            • #7
              Re: Difference between references...

              Originally posted by Tom Cone Jr View Post
              This expression refers to the "value" property of an object named "recur_dis_amt". The object name may or may not be the same as the corresponding field name in the table. Strictly speaking it's the name of the text box or other control, not the table field or variable to which the control is bound.
              I agree your statement is more proper and complete. In the example given it seems unlikely that the recur_dis_amt form object would represent anything other than the recur_dis_amt field in the memberships table.

              Originally posted by Tom Cone Jr View Post
              Most such objects also have a "text" property, and the behavior of the "text" and "value" properties is slightly different from each other. The "text" property contains the string which appears in the display of the object even before the underlying record buffer has been updated. The "value" property contains the same information, but the "data type" is adjusted to match the data type of the field or variable to which the object is bound. IIRC, this "value" property is not available to your scripts until focus leaves the object.
              Not sure I can agree with this fully.

              Create a button on a form. Make sure the button is in tab order preceeding some field so the field doesn't get focus. Code the button

              ui_msg_box("Caption",""+somefieldobjectname.value)

              should work even though we never had "focus leaves the object" occur.
              There can be only one.

              Comment


              • #8
                Re: Difference between references...

                Originally posted by Stan Mathews View Post
                As with many things, there is no right way.

                1) memberships->recur_dis_amt
                -refers to the value in the table field directly
                -changing this does not change what is displayed on the screen until the form is resynched to the table

                2) recur_dis_amt.value
                -refers to the value cited above when the record was painted on the screen
                -changing this does not affect the table until the change is saved.

                I think.
                Stan,

                That's what I thought... but I'm having a problem with some code in the "onchange" event for a field on a form. The code doesn't produce the results I expected... based on my (and your) assumtions above. I'll continue to "play with it."

                Thanks guys!
                "all things should be as simple as possible... but no simpler"

                Mike

                Comment


                • #9
                  Re: Difference between references...

                  An object on the form bound to a numeric field from the table will have a text of "5" and a value of 5. An object bound to a character field will have a text property of "5" and a value of "5".
                  In fact, if the object bound to the numeric field has any formating, the text property is everything that you see, for example:
                  The text property could be"$5.00" but the value remains the same: 5. If your xbasic uses the text itself, then you have a string with a dollar sign a numeral a dot and 2 zeros. If it uses the value property, it will be 5 as in 5 fingers.

                  This comes from the sad reality that there is no Santa Clause. There are no "True" numeric, nor date, nor logical fields in alpha or any database anywhere. Everything is a text. How does a database distinguish a numeric from a charachter from a date?
                  When you tell it so at the inception of the table: when you design a field as numeric you are only telling alpha or any other database for that matter to treat the text stored in this field as a numerical value, or a date value..etc.

                  Tom:
                  I was not really trying to be a smart Alec, but the distinction between Object and Control might come handy when you search the help file.
                  Last edited by G Gabriel; 12-16-2008, 09:01 PM.

                  Comment


                  • #10
                    Re: Difference between references...

                    Michael, since onchange fires before the object loses focus, try using the "text" property instead of the "value" property for the object.

                    Comment


                    • #11
                      Re: Difference between references...

                      Thanks Tom... got all excited, for a minute, thinking maybe that was it, but not :-(

                      It seems to have something to do with being in enter mode (i.e. adding a new record) and the way that Alpha initializes type-in field "values." The "value" property of a type-in form field, bound to a numeric table field, doesn't seem to be numeric... for a new record... unless I force it to be initialized to zero via a table field rule (i.e. default the field to zero in table field rules).

                      Or not, LOL... but doing that... i.e. setting up a table field rule to default the field to zero... seems to "fix" our problem.

                      Thanks everyone for your replies.
                      "all things should be as simple as possible... but no simpler"

                      Mike

                      Comment


                      • #12
                        Re: Difference between references...

                        Originally posted by Tom Cone Jr View Post
                        Michael, since onchange fires before the object loses focus, try using the "text" property instead of the "value" property for the object.
                        Tom,

                        BTW, we found this in the help:

                        "For type-in fields, the OnChange event fires when the control looses focus. For radio button, two-state button, multi-state button, and list box fields, the OnChange event fires as soon as the fields value changes."
                        "all things should be as simple as possible... but no simpler"

                        Mike

                        Comment


                        • #13
                          Re: Difference between references...

                          Mike;

                          Not as esoteric, or helpful as the detailed replies you've gotten, but a small tidbit of info, NEVER use table->field to set a value for a variable in xbasic code. Use the tbl.field type refference. The table->field refference is not intended for this. It may work but is not reliable. (As was told to me by S. Rabins)

                          Comment


                          • #14
                            Re: Difference between references...

                            Originally posted by milesjg View Post
                            Mike;

                            Not as esoteric, or helpful as the detailed replies you've gotten, but a small tidbit of info, NEVER use table->field to set a value for a variable in xbasic code. Use the tbl.field type refference. The table->field refference is not intended for this. It may work but is not reliable. (As was told to me by S. Rabins)
                            Thanks for the info James.
                            "all things should be as simple as possible... but no simpler"

                            Mike

                            Comment


                            • #15
                              Re: Difference between references...

                              Originally posted by michaelwpayton View Post
                              It seems to have something to do with being in enter mode (i.e. adding a new record) and the way that Alpha initializes type-in field "values." The "value" property of a type-in form field, bound to a numeric table field, doesn't seem to be numeric... for a new record... unless I force it to be initialized to zero via a table field rule (i.e. default the field to zero in table field rules).
                              The value of an uninitialized numeric field is numeric but, pardon the technical terms here, the value is "very large". If you want to test something against that value or see if it should be set to zero if otherwise untouched you can use

                              Code:
                              if formfieldobjectname.value > 10^400
                              	formfieldobjectname.value = 0
                              end if
                              This presumes you don't ordinarily deal with values > 10^400.
                              There can be only one.

                              Comment

                              Working...
                              X