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

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

    Originally posted by csda1 View Post
    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
    What's throwing me off is the "collection" definition as it applies to X-basic.....
    Years past I worked with code in either VB, or maybe Access.... I remember doing this very thing to display lists of field names. (which were considered a collection)

    My mind keeps thinking there must be a way....

    ~in this instance, to create a simple function that loops through all the field objects in a form and individually sets the enabled properties to either .T. or .F.
    Last edited by SNusa; 02-13-2012, 09:43 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


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

      This will toggle the enabled flag.

      Code:
      dim vp_Form as P = parentform.this
      lst = vp_form.CHILD_ENUM("f=field") 
      for each thingy in lst 
      eval(thingy.value+".object.enabled") =  (.not. eval(thingy.value+".object.enabled"))
      Next
      There can be only one.

      Comment


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

        Got it... Thank you!

        PS: I had somehow missed Stan's post (#29)
        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


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

          Hi Stan,

          Originally posted by Stan Mathews View Post
          This will toggle the enabled flag.

          Code:
          dim vp_Form as P = parentform.this
          lst = vp_form.CHILD_ENUM("f=field") 
          for each thingy in lst 
          eval(thingy.value+".object.enabled") =  (.not. eval(thingy.value+".object.enabled"))
          Next
          I'm not sure you can use that format, .value() is not a method of a piece of text which is what thingy is, but I don't have time to actually test it. Below is basically the code that should (haven't looked at the validity of the other methods and properties)

          Code:
          dim vp_Form as P = parentform.this
          lst = vp_form.CHILD_ENUM("f=field") 
          for each thingy in lst 
          eval(thingy+".object.enabled") =  (.not. eval(thingy+".object.enabled"))
          Next
          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


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

            Ira,

            I did test it. Errors without .value.
            There can be only one.

            Comment


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

              Originally posted by csda1 View Post
              [B].........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)
              Originally posted by Stan Mathews View Post
              Ira,

              I did test it. Errors without .value.
              Looks like there is a "thingy.value after all!"

              I guess now we have to see what happens in the IW with a call to ?thingy.this..... The For Each "thingy" construct must be one of those special cases? ~ Only a "rookie" (like me) could /would uncover "unexpected results" like this?!?!

              Irrespective, this looks like one of those strange anomalies. (Kind of like when you have to convert a pre-coded action script to inline X-basic ~ to use the .text property instead of the .value property so it works properly)......... I do understand the concepts as presented though.
              Last edited by SNusa; 02-11-2012, 12:34 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


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

                One of the good things about the message board is you get notification when someone replies.
                One of the bad things about the messages board: is you keep getting these notification, even when you thought the thread is over!. So, I kept getting these notifications and lately they refer to "thingy".
                I hate "thingies". So I had to investigate, which took me back to your post #28 in which in your code you have:


                Originally posted by SNusa View Post
                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".....)
                1-For a starter, you are trying to point to the form using parentform.this and you think that you are, but you are not. You are pointing to the button on the form that you are clicking not to the form itself and it went downhill from there.
                Evidently you "have issues" with "This". Will deal with that later.
                2"-For each" processes a list. There is no list generated by clicking the button, there is no thingy because "thingy" or any other name would subsitute for each item in a list..there is no list..and therefore there are no items..and hence and thus there is no thingy.
                3-When you soak this in, will tackle "This".
                4-Now you got "issues" with ".value" . There is no bugs nor any thingy here either. Will tackle ".value" later. One issue at a time.
                Last edited by G Gabriel; 02-11-2012, 11:05 AM.

                Comment


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

                  Hi Stan;

                  I actually think I've got it all down now. My last post was in response to post #34, and post #35 regarding the code that actually accomplishes what I was trying to do..... My usage of "thingy" was merely metaphoric. (I don't like "thingy" either. It was just the placeholder I used in the for each constructs to "testing my knowledge" that almost any name/placeholder could be used in the For Each.....

                  The additional confusion is a result of the following unexpected contradictions between what should work, and what does work:

                  ~Ira had indicated that "thingy" (in this instance) did not have properties and that Stan's code should not work when coded using thingy.value..... Stan's response (to this) was that the code only worked with thingy.value, and Ira's code didn't work without it.....


                  Originally posted by G Gabriel View Post
                  One of the good things about the message board is you get notification when someone replies.
                  One of the bad things about the messages board: is you keep getting these notification, even when you thought the thread is over!. So, I kept getting these notifications and lately they refer to "thingy".
                  I hate "thingies". So I had to investigate, which took me back to your post #28 in which in your code you have:

                  1-For a starter, you are trying to point to the form using parentform.this and you think that you are, but you are not. You are pointing to the button on the form that you are clicking not to the form itself and it went downhill from there.
                  Evidently you "have issues" with "This". Will deal with that later. ~ GOT IT. I KNOW.

                  2"-For each" processes a list. There is no list generated by clicking the button, there is no thingy because "thingy" or any other name would subsitute for each item in a list..there is no list..and therefore there are no items..and hence and thus there is no thingy. ~ GOT IT.

                  3-When you soak this in, will tackle "This". ~ I GET IT.

                  I know that in this instance (within the "loop" here), "this" refers to the button itself. (And using vp_Object=this.this could/would create a pointer reference to the button... ~So using vp_Object.hide() would then hide the button on the form.) ~ "this" either makes reference to an object (as used here in "loop"), or can return a pointer to an object. Used together it does both. (this.this)


                  4-Now you got "issues" with ".value" . There is no bugs nor any thingy here either. Will tackle ".value" later. One issue at a time.

                  I think that everyone now will have issues related to using/not using .value appended to thingy. (thingy.value) ~Because without this, (according to Stan) failing to include it, results in the code not working..... According to the two of them: "What's right doesn't work, and what works isn't right in this instance".....
                  The remaining question here is: When used in the For Each construct, what type of a5 object is this ("thingy"? (No pun intended.) It behaves like an object with properties..... It has properties that shouldn't exist, according to CSDA.) If this "thingy" is implicitly created as a variable of type C, it stands to reason that you wouldn't need to use "thingy.value" to get it's value. (but apparently you do.)

                  PS: This entire thread would appear more "intellectual" had I simply used "result_list" in place of "thingy." ~But the question remains: What type of object is "result_list", since it is "implicitly designated" by a5 within the For Each construct???
                  Last edited by SNusa; 02-11-2012, 02: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


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

                    Typeof()
                    http://support.alphasoftware.com/alp...PEOF%28%29.HTM
                    Andrew

                    Comment


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

                      Hi Robert et al,

                      It turns out it's a little more complicated as to what happens. FOR EACH Placeholder IN List is an Alpha processing command, and as such is not "normal" XBasic code. The placeholder is returned as a pointer as seen with typeof(), and in fact has a .value property, although you can not enumerate any of the pointer's properties or methods. However, if the placeholder is used in a function parameter, it's value is used for the parameter, not the pointer.

                      This is very similar to passing a pointer using Active X from XBasic, and suspect is what is happening.

                      If you place the code below as a button's event on a form, you will see 3 different ways that the same value is being returned illustrating this point. Note that this is for a character list, and may be different for an array or collection which I have not had time to investigate.

                      As to why I have not really seen it before, for the most part I have not used for each, as it was added in Alpha Five V6, and thus not backward compatible to A5v5 (which I support for some functions). In addition, it is seldom faster than just using a for ... next for most code I create, so there is not much point.

                      As for parentform.this. it returns a pointer to the form that the current object (such as a button) is on, no matter how many levels you are into objects (such as browses, tabs etc), so your usage was entirely correct.

                      Code:
                      dim vp_form as p
                      vp_form=parentform.this
                      dim list as c
                      list=vp_form.fields_enum()
                      dim item1 as c
                      dim item2 as c
                      dim item3 as c
                      dim tmpn as n
                      
                      for each item in list
                      	item1=item.value
                      	item2=substr(item,1)
                      	item3=substr(item.value,1)
                      	tmpn=ui_msg_box("Item values","item1="+item1+crlf()+"item2="+item2+crlf()+"item3="+item3+crlf(),UI_OK_CANCEL)
                      	IF tmpn=2
                      		end
                      	end if
                      next
                      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


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

                        Good call aschone!!!! I just tried this...... Turns out, my "thingy" is an object pointer after all, created from the field list. ~ Created by .CHILD_ENUM().... A pointer to values in a list (apparently considered a "collection" by Alpha, originally created from field objects. (Talk about going in circles)....

                        IRA & STAN: You might want to read this (or maybe not).....

                        ~If field objects were a collection (like I think they would have/should have been), I never would have asked the questions, which lead to more questions, and a much deeper understanding of all of this........

                        Code:
                        dim vp_Form as P = parentform.this
                        lst = vp_form.CHILD_ENUM("f=field")
                        debug(1)
                        for each thingy in lst 
                        [COLOR="#0000CD"]eval(thingy[COLOR="#FF0000"].value[/COLOR]+".object.enabled") =  (.not. eval(thingy[COLOR="#FF0000"].value[/COLOR]+".object.enabled"))[/COLOR]
                        [COLOR="#006400"]eval(thingy +".object.enabled") =  (.not. eval(thingy +".object.enabled"))[/COLOR]
                        Next
                        Both ways work.....
                        Using the code above, the net result is no change since the first line sets the object property, and the second line immediately sets it back. (If you rem one out, the other still works fine. Both lines of code working in parallel cancel one another out in this instance.)

                        AND... When you debug, and set two (2) watch variables "thingy" and "thingy.value" "the results" get a bit strange....

                        thingy.value returns one of the form objects' names (each time through the "loop." (between the {})
                        thingy returns {} (nothing) .......Until you click on the expand "+" (plus). Then thingy shows the same thing as thingy.value. (above)
                        ~ along with the .value property indicator!

                        BUT... Contrary to what Stan experienced, both lines of code works just fine for me.
                        (He probably got the error because he was building a list from the returned object values.)
                        ~This still makes no sense, because of how both lines of code (blue and green) still work in the code snippet above (attached to a form button on the on_push event)..........

                        Ira stated that the thingy.value should not work as it has no properties. Yet the .value property is required to show a value in the debugger. (Yet, within the program code, either construct works just fine when assigning the .enabled property.) ~So Alpha must be (by default) implicitly/transparently applying the (default) .value property to make the generated the X-basic inside the eval() statement work (without .value).... And the debugger indicates that my thingy has ".value!"


                        When I was referring to a "collection of objects", Alpha 5 (X-basic) was talking "class of objects" instead. (I "realized/learned" this while researching the .CHILD_ENUM() method.) And since the For Each construct doesn't support "classes of objects" (but it does support lists and collections).... These "classes" of objects must first be converted into a list, which I guess Alpha considers to be a collection.

                        Now, if I can only find a real / native a5 "collection" to try this with.....
                        HHhhmmmmmmm......
                        Last edited by SNusa; 02-11-2012, 10:18 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


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

                          Originally posted by SNusa View Post
                          Ira stated that the thingy.value should not work as it has no properties.
                          I said thingy had no properties, but said I had not tested it yet. As it turns out, thingy was a pointer and has a "hidden" property called .value. But just to be clear, thingy.value is a property, but there are no properties of thingy.value, but there is 1 property of pointer thingy (called value)

                          Originally posted by SNusa View Post
                          Yet the .value property is required to show a value in the debugger.
                          The debugger doesn't necessarily work 100% identically to the real code(although for the most part it does), so one must be careful in some cases.

                          The construct without .value works when you are using it in a parameter of a function (or an expression that is used for a parameter)

                          Originally posted by SNusa View Post
                          Technically, the form objects must be a collection, in order to create a list from in the first place. X-basic obviously doesn't allow you to access this "collection" directly though. You have to convert it
                          If you are saying an apple is not an orange, yes, Alpha XBasic is not Visual Basic or anything else. It is not a good idea to assume one language must translate to another. It might, but more likely not.
                          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


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

                            This thread can only be understood with copious amounts of alcohol I've decided.
                            See our Hybrid Option here;
                            https://hybridapps.example-software.com/


                            Apologies to anyone I haven't managed to upset yet.
                            You are held in a queue and I will get to you soon.

                            Comment


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

                              Originally posted by Ted Giles View Post
                              This thread can only be understood with copious amounts of alcohol I've decided.
                              More laughing going on here @ my home........

                              I won't quote Ira's entire reply but it clarifies quite a bit.... Especially the "debugger tip." (not working exactly like the code)

                              Originally posted by csda1 View Post
                              The construct without .value works when you are using it in a parameter of a function (or an expression that is used for a parameter)
                              I am still (however) "chewing" on this statement (above).....

                              Originally posted by csda1 View Post
                              If you are saying an apple is not an orange, yes, Alpha XBasic is not Visual Basic or anything else. It is not a good idea to assume one language must translate to another. It might, but more likely not.
                              My response ~ If you only knew!!!!!!
                              I cut my teeth on Apple II basic, and since then I've "dobbled" with quite a few languages over the years...

                              PS: When I began working with a5 (last winter) the first stuff I turned to were your CSDA tips....
                              (I had figured they would provide much insight to avoid pitfalls. I saw the value back in the beginning.)

                              Ironically, at this point, I'm almost more comfortable coding X-basic snippets than I am at picking the right form objects from the a5 gui to drop on a form...... (thanks largely to all the online help here!)


                              ~ Being on "an oasis" I can't begin to tell you how appreciative I am for all your help.....
                              (Ira, Stan, Ted, "G" and all the others who have helped me "get here from there".... Thank You!)
                              Last edited by SNusa; 02-11-2012, 10:21 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


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

                                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)
                                Ira, I'm shocked!biggrin.gif Isn't this simpler: (and at least 200 times faster according to my tests)
                                Code:
                                ui_msg_box( "Fieldlist", a5_get_fieldnames( "tablename" ) ))
                                Yeah, I know, that wouldn't have been following the intent of the thread but I couldn't help myself.

                                Comment

                                Working...
                                X