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

Pointers - Working with pointers returned from <TBL>.FIELD.GET()

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

    Pointers - Working with pointers returned from <TBL>.FIELD.GET()

    OK...

    So I realize vp_Field=<TBL>.FIELD.GET(vc_FieldName) returns a pointer reference to the table's field and places it in the pointer variable vp_Field.

    But then, how do you use this pointer to accomplish the following three (3) things?:

    • To assign the field name to a variable of type C? ----> Is this correct?: vc_Variable = vp_FieldName
      Wrong.... USE: vc_Variable = vp_Field.NAME_GET()???
    • To assign the field's value to a variable of type C? ----> Is this correct?: vc_Variable = vp_Field.this
      Wrong.... USE: vc_Variable = vp_Field.VALUE_GET()???
    • And last, how do you construct the line of X-basic (using this pointer) to assign a different record value to the table field itself?
      --> Is this correct?: vp_Field.VALUE_PUT("New Text") ~ (I know additional code is before and after this line of code is required to put the table into change mode.)
      Correct: No change necessary........


    Even if my assumptions above are correct: I am still a bit confused as to when you need to append the pointer with .this
    (UPDATE: I think I got it now.... See Note below)

    Note: While THIS can be used to make reference to an existing object (ie: this.hide() when it is placed on a button's on_push event). In contrast, appending an object with .THIS returns a pointer to the object (ie. vp_Object.hide() would hide the object after the code vp_Object = :Inventory:button1.this ~ There is a difference, see:http://wiki.alphasoftware.com/THIS for more info. (added for my own reference)
    Last edited by SNusa; 02-04-2012, 10:34 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."

    #2
    Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

    http://wiki.alphasoftware.com/Table+...ns+and+Methods

    http://wiki.alphasoftware.com/Field+...ns+and+Methods
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.
    "Make it as simple as possible, but not simpler."
    Albert Einstein

    http://www.iadn.com/images/media/iadn_member.png

    Comment


      #3
      Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

      I don't need references to these documents, I've already been there. What I asked for here, is help regarding my interpretation and usage of these reference materials. (Particularly with what effect appending / not appending the construct with .this has on the pointer.) ~ Which is why I included the three (3) specific code examples.

      I see you may have 7,000+ posts, so this question may be "beneath you." And with the work I've already invested in getting to this point, I find your response as being rather "callous, and demeaning." ~ My apologies in advance (in the event I have perceived your reply incorrectly), but there is little point in me going "around in circles" with this. That's why I requested additional help/clarification in the first place!

      "Still hoping someone will answer my plea for help".....
      Last edited by SNusa; 02-04-2012, 01:11 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


        #4
        Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

        Once you have obtained a field pointer as indicated


        vp_Field.NAME_GET()
        Returns the Fieldname of a field.

        so you want vc_Variable =vp_Field.NAME_GET()

        vp_Field.VALUE_GET()
        Returns the value of a field.

        so you want vc_Variable =vp_Field.VALUE_GET()

        vp_Field.VALUE_PUT()
        Sets the value of a field.

        so you want vp_Field.VALUE_PUT("New Text")

        Assuming you have the table still open and the appropriate tbl_pointer.change_begin() before this and tbl_change_end(.T.) after.
        There can be only one.

        Comment


          #5
          Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

          Originally posted by Stan Mathews View Post
          Once you have obtained a field pointer as indicated


          vp_Field.NAME_GET()
          Returns the Fieldname of a field.

          so you want vc_Variable =vp_Field.NAME_GET()

          vp_Field.VALUE_GET()
          Returns the value of a field.

          so you want vc_Variable =vp_Field.VALUE_GET()

          vp_Field.VALUE_PUT()
          Sets the value of a field.

          so you want vp_Field.VALUE_PUT("New Text")

          Assuming you have the table still open and the appropriate tbl_pointer.change_begin() before this and tbl_change_end(.T.) after.
          Thank you Stan. I had seen other reference examples within the wiki, and it was not until I found the info on the two ways that THIS is used in code, that it all started to make sense. (I updated my OP here to reflect this.)

          NOTE: This post actually originated as a result of trying to help someone else. Some of the examples were throwing me off a bit, and I certainly didn't want to provide incorrect information.) ~ Now I "got it!"
          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


            #6
            Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

            Robert,

            I think it's wrong to assume malice, indifference, or arrogance when a behavior that rubs me the wrong way may be the result of a simple mistake or misunderstanding.

            Having spent WAY too much time on this board I've learned that it's an imperfect mode of communication. Misunderstandings will occur. The medium we're using almost guarantees it.

            So, I try to give "the other guy" the benefit of the doubt before taking offense. I've learned not to finish sentences that begin with...

            "My apologies in advance, but ..."
            "I hope you won't be offended, but ..."
            "I hope you won't take this the wrong way, but ..."

            For the most part I succeed, but not always.

            Extending the benefit of the doubt to others helps us all keep the tenor of the discussions here on a positive and helpful plane. Extending the benefit of the doubt to volunteers who are spending their time trying to help me is the least that I can do.

            -- tom

            Comment


              #7
              Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

              Not quite.

              Try this for the onpush event code of a button on the AlphaSports invoice form.

              Code:
              tbl = table.current()
              vp_Field=TBL.FIELD[COLOR="#FF0000"][B]_[/B][/COLOR]GET("invoice_number")
              vc_Variable = vp_[COLOR="#FF0000"]Field[/COLOR].NAME_GET()
              ui_msg_box("",""+vc_variable)
              vc_Variable = vp_[COLOR="#FF0000"]Field[/COLOR].VALUE_GET()
              ui_msg_box("",""+vc_variable)
              Copy and paste from here. There is an underscore between field and get in .field_get(), not a period.
              There can be only one.

              Comment


                #8
                Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

                In another post, I have been trying to get a field reference, however you need to know the table. If there is a form with many tables in use, i.e. a set, how can one get the field refrence? It seems you need the table to get the field pointer and the field pointer to get the table. Is there a simple way to get the current table/field in an onactivate event without knowing either? I believe that tbl.current() only gets you the parent table in the set correct?

                Comment


                  #9
                  Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

                  Originally posted by Tom Cone Jr View Post
                  I think it's wrong to assume malice, indifference, or arrogance when a behavior that rubs me the wrong way may be the result of a simple mistake or misunderstanding.
                  I wholeheartedly agree. And that's why I (giving benefit of doubt) included this in the response directed back (in this instance tactfully) towards the responding moderator:

                  My apologies in advance (in the event I have perceived your reply incorrectly), but there is little point in me going "around in circles" with this. That's why I requested additional help/clarification in the first place!
                  I for one, use this message board as a last result, after exhausting all my own resources. When I seek out help here, (unlike some others possibly) I'm not "just shooting blindly from the hip." (at least I hope I'm not)

                  If I can't figure something out using the a5 GUI, I head for v9 .CHM help files. I'll also look in the online Wiki and then search for help on the forums. (Many times I bounce around back and forth and thus am finally able to self learn what I need.) ~ I spend a lot of time "digging around" before I resort to asking for help here. So when I ask for help, by golly, I need it.

                  Most certainly, that's the reason for my "heated response."


                  Recently I've run into "pleas" for help from others who have encountered questions and problems similar to those I recall "wrestling with" in the past. All too frequently (lately it seems) some "seasoned user" chimes in with a non-helpful response which implies "Why are you wasting my time? - Go here for the answer." ~ And I must admit that when this happens, I find it little disheartening. (of course, there are instances when a response like this is warranted)

                  It's worth noting that: I honestly spend a significant amount of time detailing my requests for help here. ~ With the intent of conveying my research efforts, and my "current abilities / experience level" (which is nothing to brag about) to other readers.
                  Last edited by SNusa; 02-04-2012, 10:39 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


                    #10
                    Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

                    Originally posted by johngtatp View Post
                    I believe that tbl.current() only gets you the parent table in the set correct?
                    Actually not. There is an argument that you can add to use the number of the table that you want to point to.

                    http://wiki.alphasoftware.com/TABLE.CURRENT+Method
                    Al Buchholz
                    Bookwood Systems, LTD
                    Weekly QReportBuilder Webinars Thursday 1 pm CST

                    Occam's Razor - KISS
                    Normalize till it hurts - De-normalize till it works.
                    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                    When we triage a problem it is much easier to read sample systems than to read a mind.
                    "Make it as simple as possible, but not simpler."
                    Albert Einstein

                    http://www.iadn.com/images/media/iadn_member.png

                    Comment


                      #11
                      Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

                      Robert,

                      As you spend more time on the board, I hope you'll resist the urge to "judge" how helpful or "non-helpful" volunteer responses might seem.

                      In cases where you think a responder has missed the point, or failed to offer the amount of assistance that you might judge appropriate, I hope you will consider supplementing the thread with your own post without criticizing the efforts of others who are trying to help.

                      I appreciate the time you dedicate to your posts and questions. It's evident to me that you are using the message board for help only after looking for answers in other places. Unfortunately, many who begin threads here do not, and in many cases it's impossible to discern whether someone has even bothered to look. Others have difficulty using the wiki as a reference tool. In these cases a succinct reply referencing the pertinent sections of the documentation is entirely appropriate.

                      Comment


                        #12
                        Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

                        Originally posted by johngtatp View Post
                        In another post, I have been trying to get a field reference, however you need to know the table. If there is a form with many tables in use, i.e. a set, how can one get the field refrence? It seems you need the table to get the field pointer and the field pointer to get the table. Is there a simple way to get the current table/field in an onactivate event without knowing either? I believe that tbl.current() only gets you the parent table in the set correct?
                        How about adding the code in each of the tables field rules? (onChange record event using tbl.current() would refer to the browse record that is changing)

                        You'll also probably want to build in a test to make sure this script would only run when the specific form was open, so it wouldn't fire when the table is used for some other purpose, or on a different form.
                        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


                          #13
                          Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

                          When you use table.current() you are accepting the default parameter of 1 which is the top level table in a set. You refer to lower level tables with their position number.

                          table.current(2)
                          table.current(3)
                          table.current(4)
                          etc.

                          When the onactivate event fires there is no current field. Try this for the onactivate event code.
                          Code:
                          delete obj
                          delete obj_table_ptr
                          delete obj_field_ptr
                          
                          obj_table_ptr_name = ""
                          obj_field_ptr_name = ""
                          obj = parentform.this
                          obj_table_ptr = obj.table_get()
                          obj_table_ptr_name = obj_table_ptr.name_get()
                          
                          obj_field_ptr = this.this
                          obj_field_ptr_name = obj_field_ptr.name()
                          
                          ui_msg_box("",""+obj_table_ptr_name)
                          ui_msg_box("",""+obj_field_ptr_name)
                          You should get messages telling you the name of the table and the name of the form.

                          You might try the same for the onarrive event of a form.
                          Last edited by Stan Mathews; 02-04-2012, 11:18 PM.
                          There can be only one.

                          Comment


                            #14
                            Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

                            Originally posted by Tom Cone Jr View Post
                            Robert,

                            As you spend more time on the board, I hope you'll resist the urge to "judge" how helpful or "non-helpful" volunteer responses might seem.
                            Will do! (I probably initially responded out of frustration more than anything else..... And yes, as I also mentioned, I agree ~ sometimes a response like that is 100% warranted.)

                            I'm sure I was thinking to myself: "I spent all this time only to finally resort to asking for/needing help, and this is the help I get?"

                            PS: As I mentioned in my original response (apologies in advance), Sorry Al.
                            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


                              #15
                              Re: Pointers - Working with pointers returned from &lt;TBL&gt;.FIELD.GET()

                              Originally posted by Stan Mathews View Post
                              Not quite.

                              Try this for the onpush event code of a button on the AlphaSports invoice form.

                              Code:
                              tbl = table.current()
                              vp_Field=TBL.FIELD[COLOR="#FF0000"][B]_[/B][/COLOR]GET("invoice_number")
                              vc_Variable = vp_[COLOR="#FF0000"]Field[/COLOR].NAME_GET()
                              ui_msg_box("",""+vc_variable)
                              vc_Variable = vp_[COLOR="#FF0000"]Field[/COLOR].VALUE_GET()
                              ui_msg_box("",""+vc_variable)
                              Copy and paste from here. There is an underscore between field and get in .field_get(), not a period.
                              Thanks, fixed the typo incorrectly referencing vp_FieldName instead of vp_Field. (I had changed the pointer's name to reflect all operations, and failed to make changes in the examples) Guess I should have added Option Strict to the code, then the "built-in forum code validator" might have caught it!

                              All examples work like a charm, and as expected. ~Thanks to all!
                              Last edited by SNusa; 02-05-2012, 01:17 AM.
                              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