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

$10,000 Question ~ "The foo variable"

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

    #16
    Re: $10,000 Question ~ "The foo variable"

    Originally posted by csda1 View Post
    .......Don't use foo, foobar or anything else like that. That is just a programming convention for "Fill in the Blank here"

    Use a variable name that has meaning!. Don't reuse a variable in any single piece of code unless it is a temporary variable. By using different names, when you have a program bug, it is much easier to find.

    And, if you happen to use the same name as an Alpha variable name in the same variable space, you or Alpha could overwrite the variable with different data, so it is a bad idea
    Understood.....

    Let me rephrase my question: In Alpha, when using the FOR EACH to cycle through a collection, any variable name could conceivably work as the placeholder. In the v9 help file example, (after reviewing the FOR EACH operator)..... I noticed that Alpha ironically just happened to chose the variable foo in their example!

    My point (or question actually) was, they could have just as well used the variable foobar or widget in this example, (even though it's a bad idea) right?

    Code:
    [INDENT][COLOR="#0000CD"]
    for each foo in list
        if foo = "c"
            continue
        end if
        ui_msg_box("", foo.value)
    next[/COLOR][/INDENT]
    Consequently, I could conceivably construct X-basic code as follows to extract field names from a table:
    (using any good name for the placeholder)

    Code:
    '***LOOP THROUGH TABLE FIELDS AND OUTPUT NAMES IN STRING
    
    [COLOR="#0000CD"][COLOR="#696969"]FieldName as P[/COLOR]
    vp_Table as P
    vc_AllFieldNames as C
    
    vp_Table=Table.current()
    'vp_TableName.fetch_first()
    
    FOR EACH [COLOR="#696969"]FieldName[/COLOR] in vp_Table
       vc_AllFieldNames = vc_AllFieldNames + chr(32) + this.Field_Name_Get()
    NEXT
    
    showvar(alltrim(vc_AllFieldnames))
    
    'NOTE:  vp_FieldName is [B]possibly dimmed incorrectly[/B], but regardless I could have technically used any variable
    '         name in it's place, providing it's not used elsewhere / violates scope[B]?????[/B][/COLOR]
    Last edited by SNusa; 02-02-2012, 03:05 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


      #17
      Re: $10,000 Question ~ "The foo variable"

      Originally posted by SNusa View Post
      My point (or question actually) was, they could have just as well used the variable foobar or widget in this example
      And then you would, or someone else would , have asked the question: why didn't they use FOO?

      FOO started in the olden days..and programmers (monkey see monkey do).. continued to use it for that purpose. Same as "Hello World"..
      This doesn't mean you can't break that mold whenever you wish.

      for each foo in list ... is the same as:
      for each Felicia in list.. or
      for each Lamat in list.. or
      for each my_dog_dingo in list
      ..
      etc.

      I don't want to pick up a fight with Ira here..and I don't see anything wrong with what he is saying as far as dimming the variable and so on..all that is fine and dandy. It's a deviation from the FOO concept and convention and I don't see any problem with that either. It will serve the purpose just fine and in Ira's mind and contentions, it's a better practice, and that's fine too.. but your question (and I want to know where is that $10,000? Or is that just a Romney bet?) has to do with FOO..who is FOO? where did he or she come from? where does he live? and why?

      FOO, or any substitute name is a unique type of "variable". It's best described as a placeholder"..it is a "variable" on the fly. In other words, alpha (or any other application for that matter) will recognize it as a placeholder, something to hold a value for a one time process with no intention of being used subsequently. Once the process is done, this placeholder is wiped out..In other words, FOO is a "Pawn".. a "punk"...a "goefer" ..doesn't even have the status of a legitimate variable..even though it is a "variable" but it is a one-time variable only meant as a placeholder.
      Last edited by G Gabriel; 02-02-2012, 08:34 AM.

      Comment


        #18
        Re: $10,000 Question ~ "The foo variable"

        Originally posted by G Gabriel View Post
        This doesn't mean you can't break that mold whenever you wish.

        for each foo in list ... is the same as:
        for each Felicia in list.. or
        for each Lamat in list.. or
        for each my_dog_dingo in list
        ..
        etc.
        Got it! Thanks.

        PS: As for the $10,000 question ~ It's an election year here in the US. You know, with false promises & all! (Seriously though, I am surprised this post received all the responses it did. As I mentioned previously, Selwyn's only response to me was he didn't know anything about it. ~ And he seems to know almost everything!)

        Funny thing is: I kept thinking (all these years after looking at the Alpha Sports database time and time again before finally "getting this down) the following:

        "What kind of company would write code and leave weird things like a "foo" variable to pop up without explanation." ~ Seeing it appear was never a confidence builder. And Selwyn's response actually scared me with regards to the actual solidness of the a5 platform. (I had encountered / documented / & reported so many legitimate bugs over the years, that after seeing this "foo" variable pop seemingly for no reason, I became wary of a5.) ~ As usual, it turns out it was just my ignorance.

        NOTE: When you learn a tool like a5 as I did, from the ground up.... You run into all sorts of oddities, bugs, and unexpected behaviors that a seasoned user would never uncover. I'm sure that's why I was turning up all these bugs, even 6 months after the version releases. (and this goes all the way back to version 8) ~ I have versions back to the mid 90's on floppy, but didn't have time / opportunity to pursue and really use them way back when.

        All my life, I've been a "bug magnet." (It's just the way it is. If there's a bug, I run into it. ~ Or is that the other way around?)


        What's really surprising is: This "foo" concept wasn't referenced once in the hundreds of hours of training videos I watched numerous times. (and took notes on) I guess I shouldn't be overly surprised, because I have yet to run into a single training video that even brushes on the concept of holding down the <shift><control> keys while launching a database to disable "auto-starts!"
        Last edited by SNusa; 02-02-2012, 09:04 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


          #19
          Re: $10,000 Question ~ &quot;The foo variable&quot;

          Originally posted by SNusa View Post
          Understood.....

          Let me rephrase my question: In Alpha, when using the FOR EACH to cycle through a collection, any variable name could conceivably work as the placeholder.
          Any variable name of the appropriate data type can be used. E.g. if stepping through an array with 10 elements, if a numeric values in the array, the placeholder must be numeric. If 10 character values, then it better be character type. 10 dates, it would need to be date type. If undefined previously at any scope level, there is an implicit dimensioning at the local level of the data type.

          Originally posted by SNusa View Post
          In the v9 help file example, (after reviewing the FOR EACH operator)..... I noticed that Alpha ironically just happened to chose the variable foo in their example!
          It's not ironic, it's as I said, a programming convention to say "fill in the blank with your own name here". As to whether you should use a professional programming convention for most non-programmers using Alpha, I'd say no, unless you said that up front.

          Originally posted by SNusa View Post
          My point (or question actually) was, they could have just as well used the variable foobar or widget in this example, (even though it's a bad idea) right?
          Yes they could have, or they could have said "Fill_in_a_name_of_your_choosing" or anything else as well. The point is to convey to a reader that they need to use their own value. I always would say clarity is preferred in naming, and foo is not it. Your fieldname variable is in the right direction, although the code is not concatonating the next value. For a character type, for each returns each line sequentially as a value for each loop

          Originally posted by SNusa View Post
          Code:
          [INDENT][COLOR="#0000CD"]
          for each foo in list
              if foo = "c"
                  continue
              end if
              ui_msg_box("", [B]foo.value[/B])
          next[/COLOR][/INDENT]
          The bolded part should be foo, not foo.value

          Originally posted by SNusa View Post
          Consequently, I could conceivably construct X-basic code as follows to extract field names from a table:
          (using any good name for the placeholder)

          Code:
          '***LOOP THROUGH TABLE FIELDS AND OUTPUT NAMES IN STRING
          
          [COLOR="#0000CD"][COLOR="#696969"]FieldName as P[/COLOR]
          vp_Table as P
          vc_AllFieldNames as C
          
          vp_Table=Table.current()
          'vp_TableName.fetch_first()
          
          FOR EACH [COLOR="#696969"]FieldName[/COLOR] in vp_Table
             vc_AllFieldNames = vc_AllFieldNames + chr(32) + this.Field_Name_Get()
          NEXT
          
          showvar(alltrim(vc_AllFieldnames))
          
          'NOTE:  vp_FieldName is [B]possibly dimmed incorrectly[/B], but regardless I could have technically used any variable
          '         name in it's place, providing it's not used elsewhere / violates scope[B]?????[/B][/COLOR]
          You never used Fieldname in the loop above. The code above will not work as presented.

          In *for_each() function, I typically use X for unknown as the placeholder (This actually has no dimension and is run in a private variable space within the *for_each() execution), and is simply used as a substitution of a variable with a value for each line or array element as it is processed.
          Regards,

          Ira J. Perlow
          Computer Systems Design


          CSDA A5 Products
          New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
          CSDA Barcode Functions

          CSDA Code Utility
          CSDA Screen Capture


          Comment


            #20
            Re: $10,000 Question ~ &quot;The foo variable&quot;

            Originally posted by csda1 View Post
            You never used Fieldname in the loop above. The code above will not work as presented.

            In *for_each() function, I typically use X for unknown as the placeholder (This actually has no dimension and is run in a private variable space within the *for_each() execution), and is simply used as a substitution of a variable with a value for each line or array element as it is processed.
            Thanks Ira;

            So in order to make my code work, I still need to find a way to reference the table's "fields collection"....
            Is there a way to do this using the FOR EACH construct? ( or must you do it another way, like this?):
            I can't find any way to "grab a pointer" to reference this collection using X-basic.
            (looking at the X-basic Explorer for reference)

            Code:
            '[COLOR="#0000CD"]**  IS THIS THE ONLY WAY TO DO THIS WITH TABLE FIELDS??[/COLOR]
            
            for i = 1 TO tbl.fields_get()
                fld = tbl.field_get(i)
                fnames[i] = fld.name_get()' square brackets required in version 6 and above
            next i
            Bear with me, I'm almost there........ PS: Just ordered CDSA code utility (PRO) moments ago.....
            Last edited by SNusa; 02-02-2012, 09:53 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


              #21
              Re: $10,000 Question ~ &quot;The foo variable&quot;

              Hi Robert,

              Originally posted by SNusa View Post
              Code:
              '[COLOR="#0000CD"]**  IS THIS THE ONLY WAY TO DO THIS WITH TABLE FIELDS??[/COLOR]
              
              for i = 1 TO tbl.fields_get()
                  fld = tbl.field_get(i)
                  fnames[i] = fld.name_get()' square brackets required in version 6 and above
              next i
              for each is normally used where you don't know the number of items, nor do you care what position it is, just that you want to iterate through values and have some variable that for each can iterate through. For, Next as you used above is kind of OK, except, you are recalculating the field count for every iteration of the loop, you didn't DIM variables, and the loop can be simplified to 1 line as below.

              shown below is best when you have the exact count and works better for this case

              Code:
              dim tblptr as p
              tblptr=table.open("tablename")
              dim fldcnt as n
              fldcnt=tblptr.fields_get()
              dim i as n
              dim fldlst as c
              fldlst=""
              for i=1 to fldcnt
              	fldlst=fldlst+tblptr.field_get(i).name_get()+crlf()
              next
              tblptr.close()
              ui_msg_box("Fieldlist",fldlst)
              But don't use a sledge hammer when a hammer will do. This is the simplest way

              Code:
              dim tblptr as p
              tblptr=table.open("tablename")
              dim fldlst as c
              fldlst=tblptr.field_name_get()
              tblptr.close()
              ui_msg_box("Fieldlist",fldlst)
              Regards,

              Ira J. Perlow
              Computer Systems Design


              CSDA A5 Products
              New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
              CSDA Barcode Functions

              CSDA Code Utility
              CSDA Screen Capture


              Comment


                #22
                Re: $10,000 Question ~ &quot;The foo variable&quot;

                Originally posted by csda1 View Post
                But don't use a sledge hammer when a hammer will do. This is the simplest way

                Code:
                dim tblptr as p
                tblptr=table.open("tablename")
                dim fldlst as c
                fldlst=tblptr.field_name_get()
                tblptr.close()
                ui_msg_box("Fieldlist",fldlst)
                I knew the code I pasted (prior post above) was sloppy. It's a direct cut/past from the a5 .chm (v9/10) help file. (to expedite)

                And I was thinking the exact same thing regarding not needing a "sledgehammer." (I knew I could do it via your second code example, having seen the field_name_get() method in the XBE.) ~ I was just learning / looking for an alternative using the FOR EACH. (The a5 documentation indicates it can loop through lists, arrays, and collections, and in my mind, the field names are a collection.

                (Apparently, there's just no way to reference this "collection" as a collection for use in a FOR EACH construct.)

                "My mind is like a sponge right now."


                PS: I never would have started this thread had I found this, and others: http://msgboard.alphasoftware.com/al...Please-explain I searched for foo here and found nothing meaningful, until the thread (along with others) appeared in a different search while searching for "ghost"!
                Last edited by SNusa; 02-09-2012, 12:37 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


                  #23
                  Re: $10,000 Question ~ &quot;The foo variable&quot;

                  Hi Robert,

                  Originally posted by SNusa View Post
                  I was just learning / looking for an alternative using the FOR EACH. (The a5 documentation indicates it can loop through lists, arrays, and collections, and in my mind, the field names are a collection.

                  (Apparently, there's just noway to reference this "collection" as a collection for use in a FOR EACH construct.)
                  What made you think the table is a collection?

                  A collection is a data type in Alpha. You reference a value by a "Key". So keys Robert, Ira and Sally might have gender as Male, Male and Female respectively. The key is like an index or array indice number, except it is a character key value.

                  A table pointer returns a class of objects that include a variety of methods (basically same as a function) and values and pointers which could include a collection type, but as far as I know, does not. If there was a collection pointer in a property of the table, then yes, you could iterate through that collection.

                  Based on my experience on V8, collections at that time started to become unstable when the number of keys got large (maybe 5000 or more). I haven't really tested to see if later versions were more reliable with large collections.
                  Regards,

                  Ira J. Perlow
                  Computer Systems Design


                  CSDA A5 Products
                  New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                  CSDA Barcode Functions

                  CSDA Code Utility
                  CSDA Screen Capture


                  Comment


                    #24
                    Re: $10,000 Question ~ &quot;The foo variable&quot;

                    Originally posted by csda1 View Post
                    What made you think the table is a collection?
                    "In my mind" (here we go, right?) ~ The actual fields within the table collectively make up a "collection of table fields." (That's what I was thinking.)

                    I'm pretty sure that in years gone by, in visual basic maybe, as I know it wasn't "Apple Basic" (again, showing my "age").... I was using FOR EACH statements on an access database, table to grab field names and their respective values. ~ I could be wrong though, it was many years ago.
                    Last edited by SNusa; 02-02-2012, 02:13 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


                      #25
                      Re: $10,000 Question ~ &quot;The foo variable&quot;

                      Further research has prompted a few more questions here, relative to my "incorrect assumption" that the fields in a table were considered a "collection."

                      Where can I review a definitive list of "collections" (a5 objects) upon which:

                      1.) The for...next[i] loop can be applied?
                      2.) The for each loop could be used?*

                      NOTE: Having now been "introduced" to the *FOR_EACH() function... I presume it could be optionally used (instead of the for each loop) in some situations, right?


                      Originally posted by csda1 View Post
                      In *for_each() function, I typically use X for unknown as the placeholder (This actually has no dimension and is run in a private variable space within the *for_each() execution), and is simply used as a substitution of a variable with a value for each line or array element as it is processed.
                      * After thinking about your response, I'm inclined to believe that the for each loop "technically" could be used in my example, although knowing the number in the collection makes the for...next[i] the method of choice?
                      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


                        #26
                        Re: $10,000 Question ~ &quot;The foo variable&quot;

                        Originally posted by SNusa View Post
                        Where can I review a definitive list of "collections" (a5 objects) upon which:....
                        There is no list of A5 objects. I don't think any Alpha Five function returns a collection (data type U), but I could be wrong. Most return a list, and a few return an array. If it returns a pointer, some of the properties can be a list, array or collection. If the function or method or other code returns a character type, array or a collection (data type U), then you can process it as follows (basic info only below).
                        • FOR EACH ... NEXT processes each element of the object (it knows the number)
                          each element of an array (I'm not sure what happens with multi-dimensional array)
                          each line of list (CRLF delimited)
                          each key of a collection (Type U)
                        • FOR ... NEXT can process the same types as the FOR EACH ... NEXT except you must know the size of the array, number of lines of a list, or the number of keys in a collection, and initialize the index to the initial value and loop count based upon the # of items you want processed
                        • *for_each() can process a list or array, 1 item at a time, but the result is always a character string that is a concatonation of an expression of each line or array element. The result may be directly used, or may be making a long piece of text to be used with eval() or evaluate_template() or similar


                        There are a number of array functions that can process all of the array as well, but they only work with an array, although when much faster, it can be worth the conversion time from other data types to use a fast array function. Regex_Grep() and regex_Merge() can process text strings extremely fast, but take a while to learn to use to advantage. And there are a variety of text string functions that work very fast on lists, *for_each() and Filter_String_Smatch() and a few others.

                        See also my Speed Tips here
                        Regards,

                        Ira J. Perlow
                        Computer Systems Design


                        CSDA A5 Products
                        New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                        CSDA Barcode Functions

                        CSDA Code Utility
                        CSDA Screen Capture


                        Comment


                          #27
                          Re: $10,000 Question ~ &quot;The foo variable&quot;

                          Your speed tips are invaluable, (just like everything else). I've spent much time on your site already!
                          Your reply above clarified more concepts (in my mind) than you could ever imagine! ~ Thank you Ira, for making things "click!"

                          I had been thinking that possibly all of the a5 System Objects (displayed within the XbE) were in fact all the "objects" upon which the for...next and for each constructs could be used. ~ Seems/Seemed plausible at least....

                          PS: Ira, I ran across this code in the wiki, while analyzing your last post: Wiki Code Example
                          (I never new that Alpha was communicating with you directly via code examples)....


                          ~Hey Neo, are you still parsing data from The Matrix? ~ "I'm beginning to believe."

                          Code:
                          dim cc as C
                          cc = <<%a%
                          My house has 3 doors
                          and 26 windows
                          I don't miss Windows 3.1
                          Who does?
                          Ira, did you leave the window open?
                          %a%
                          txt = regex_grep(cc, "(W|w)indow", "$(offset): $(LINETEXT)" + crlf() )
                          ? txt
                          = 30: and 26 windows
                          52: I don't miss Windows 3.1
                          [B][COLOR="#FF0000"]99: Ira, did you leave the window open?[/COLOR][/B]
                          ~ My "phone" is ringing...... I'm in!
                          Last edited by SNusa; 02-10-2012, 01:54 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


                            #28
                            Re: $10,000 Question ~ &quot;The foo variable&quot;

                            OK, I've got all the other stuff working except this:

                            When placed on a on_Push button event (on a form):

                            Code:
                            dim vc_String as C = ""
                            dim vp_Form as P = parentform.this
                            
                            for each thingy in vp_Form [I][COLOR="#0000CD"]'vp_Form.Fields_Enum()[/COLOR][/I]
                            	ui_msg_box("This thingy value:",this.object.name) [I][COLOR="#0000CD"]'thingy.object.name[/COLOR][/I]
                            	vc_String = vc_String + this.object.name
                            Next
                            ui_msg_box("ALL FORM OBJECTS:",vc_String)
                            The debugger errors with: Variable "thingy" not found (on first loop).
                            Also, this.object.name always refers to the "calling button" name. (understandable, since the for...each loop isn't working)

                            I've also tried substituting (see blue remarks) to no avail.....
                            (Then I get the "unexpectd expression type in FOR EACH Type is '\' Expression is 'Invoice.Fields_Enum()' error)

                            Must be something simple I'm not doing properly here...... ~ Let me guess, the form objects are not part of a "collection" either?
                            (Even so, shouldn't the substitutions work? ~ "So close, yet so far".....)
                            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


                              #29
                              Re: $10,000 Question ~ &quot;The foo variable&quot;

                              dim vp_Form as P = parentform.this

                              establishes a pointer to the form. A pointer is not a list of the objects on the form.

                              Try

                              dim vc_String as C = ""
                              dim vp_Form as P = parentform.this
                              lst = vp_form.CHILD_ENUM()
                              for each thingy in lst
                              ui_msg_box("This thingy value:",thingy)
                              vc_String = vc_String + thingy
                              Next
                              ui_msg_box("ALL FORM OBJECTS:",vc_String)

                              Will be more readable if you use

                              vc_String = vc_String + crlf() + thingy
                              Last edited by Stan Mathews; 02-10-2012, 04:54 PM.
                              There can be only one.

                              Comment


                                #30
                                Re: $10,000 Question ~ &quot;The foo variable&quot;

                                Originally posted by SNusa View Post
                                OK, I've got all the other stuff working except this:

                                When placed on a on_Push button event (on a form):

                                Code:
                                dim vc_String as C = ""
                                dim vp_Form as P = parentform.this
                                
                                for each thingy in vp_Form [I][COLOR="#0000CD"]'vp_Form.Fields_Enum()[/COLOR][/I]
                                	ui_msg_box("This thingy value:",this.object.name) [I][COLOR="#0000CD"]'thingy.object.name[/COLOR][/I]
                                	vc_String = vc_String + this.object.name
                                Next
                                ui_msg_box("ALL FORM OBJECTS:",vc_String)
                                The debugger errors with: Variable "thingy" not found (on first loop).
                                Also, this.object.name always refers to the "calling button" name. (understandable, since the for...each loop isn't working)

                                I've also tried substituting (see blue remarks) to no avail.....
                                (Then I get the "unexpectd expression type in FOR EACH Type is '\' Expression is 'Invoice.Fields_Enum()' error)

                                Must be something simple I'm not doing properly here...... ~ Let me guess, the form objects are not part of a "collection" either?
                                (Even so, shouldn't the substitutions work? ~ "So close, yet so far".....)
                                for each thingy in vp_Form
                                There is no thingy in vp_Form. vp_Form is a pointer. It must be an array, text or collection

                                for each thingy in vp_Form.Fields_Enum()
                                vp_Form.Fields_Enum() returns a list of fields
                                each loop iteration returns a line of text from the list (without the CR-LF) in the variable thingy.
                                You can use thing to display the text as in ui_msg_box("This thingy value:",thingy) or just compute something else in the loop. There is no thingy.value, thingy.object.name, or any thing else, unless thingy is a pointer, which it won't be for a list. (it might be for a collection or array value, but that would be an array or collection of other objects, who only use methods and properties of those objects)
                                Regards,

                                Ira J. Perlow
                                Computer Systems Design


                                CSDA A5 Products
                                New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                                CSDA Barcode Functions

                                CSDA Code Utility
                                CSDA Screen Capture


                                Comment

                                Working...
                                X