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

Alpha Tech: Xdialog & Collections

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

    Alpha Tech: Xdialog & Collections

    Is there a way to use collections in Xdialog. I know you can use arrays like var[1]. I am used to them being called hashes and in PERL the way you refered to them was var{key}. Is there or will there be a way of doing this?

    Thanks
    Jamin

    #2
    RE: Alpha Tech: Xdialog & Collections

    i am not sure what you want to do with the collection, but assuming you have a collection, and you want to display a list box with the data in the collection, then you would first have to dump the data from the collection into a crlf delimited string (the collection object supports a method to dump out it contents), then then use the resulting crlf string in your xdialog.



    in general, i like property arrays better than collections because there is a lot more power associated with property arrays.

    Comment


      #3
      RE: Alpha Tech: Xdialog & Collections

      With collections you do not need to know the order of the fields in a table because it is determined by key not sequential order.

      I have a vendor table I want to display a quick pop up window with info of that vendors record. I can put all the values into a collection and access them by key without having to know the order of the fields.

      Jamin

      Comment


        #4
        RE: Alpha Tech: Xdialog & Collections

        Jamin

        I also like using collections since I can use a key value to find a value in the collection and I don't need to determine ahead of time how many records will be in the collection. Converting to crlf delimited list is simple for use in an xdialog using mycollection.dump("value"). See page 63 of the xbasic manual.

        Jerry

        Comment


          #5
          RE: Alpha Tech: Xdialog & Collections

          it is true that you can use a key to find a value in a collection. that's nice.

          however, property arrays have these benefits:

          1. a collection is essentially a two column table. key is column 1 and data is column 2. --- a property array is a table with unlimited number of columns.

          2. you can find a value in a property array by key.
          for example, say that you have this property array:

          dim a[10] as p
          a[1].name = "jerry"
          a[1].city = "london"
          a[2].name = "selwyn"
          a[2].city = "boston"


          now, say i want to find the city for "jerry"

          indx = a.find("jerry","name")
          ?a[indx].city


          in practice, i would make the array search case and length insensitive, and i would protect for no match.

          indx = a.find(ut("jerry"),"ut(name)")
          if index > 0 then
          city = a[indx].city
          else
          city = "Not found"
          end if

          Comment


            #6
            RE: Alpha Tech: Xdialog & Collections

            Jamin,

            Coming from a Perl and PHP background myself, I was a bit confused with Xbasic arrays at first and thought I was limited in what I could do. But after some time with Xbasic, I think it is actually easier to work with. Here are a couple of options for you.

            1) Dot variables - With this arrangement you would have something like:

            dim data as p
            data.firstname = "Lenny"
            data.lastname = "Forziati"
            data.phone_number = "781-229-4500"

            It sounds like this would meet your needs for what you are trying to do. This essentially gives you keys for each piece of data which elminates the need to track field order.

            2) Pointer array - Store multiple records with something like:

            dim data[2] as p
            data[1].firstname = "Jamin"
            data[1].lastname = "Dunivan"
            data[2].firstname = "Lenny"
            data[2].lastname = "Forziati"

            Xbasic will do what you need, it just does it a bit differently than Perl.

            -Lenny

            Lenny Forziati
            Vice President, Internet Products and Technical Services
            Alpha Software Corporation

            Comment


              #7
              RE: Alpha Tech: Xdialog & Collections

              In PERL you can have hashes of hashes(hash=collection), hashes of arrays, arrays of hashes and arrays of arrays. This is very powerful functionality that I am used to. I was delighted to see that you added collections but I guess I kind of compared it to PERL without actually digging into it.

              I will study your examples. Thank You!
              Jamin

              Comment


                #8
                RE: Alpha Tech: Xdialog & Collections

                Thanks Lenny!

                It helps to hear from somone who knows where I am!

                Jamin

                Comment


                  #9
                  RE: Alpha Tech: Xdialog & Collections

                  Collections and dot variable arrays each have advantages depending on what you are doing. Collections work real well if you only need a key value and a single return value. For instance, state abbreviations and state names, or a product code and product description. Dot.variable arrays are nice if each array entry has more that one associated value as in Selwyn's example. The variable a[1] has name and city or more. I have found uses for both.

                  Like many things in Alpha, there is more than one way to get similar results. You just have to fit the method to the need.

                  Jerry

                  Comment


                    #10
                    RE: Alpha Tech: Xdialog & Collections

                    without knowing perl, i suspect that there is equivalent functionality in a5.

                    a5's property arrays are incredibly powerful because you can have an unlimited number of nested arrays (which sounds a little like what you are talking about.

                    consider this.

                    dim a[3] as p
                    a[1].name = "fred"
                    dim a[1].kids[3] as p
                    a[1].kids[1].name = "sam"
                    a[1].kids[1].age = 9
                    a[1].kids[2].name = "john"
                    a[1].kids[2].age = 3
                    a[1].city = "boston"

                    in this case a[1] has 3 properties: name-- a char variable, kids -- a property array (i.e. a nested array) and age -- a numeric variable.

                    then, the icing on the cake is a5's property_to_string() function which allows you to dump out a complex variable (such as 'a' in this case) to a string, so that you can save the contents of your array and then later reinitialize it.

                    Comment


                      #11
                      RE: Alpha Tech: Xdialog & Collections

                      What? Wow! And I am just getting the hang of simple dot variables. I never knew about nested arrays. Got to back to the manual....

                      Jerry

                      Comment

                      Working...
                      X