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



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

Array Puzzle?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Array Puzzle?

    I am working on the early stages of a report preview button that uses an array to pop up a list of members by State, City, or Zip,the report will be filtered accordingly. The form is based upon a table called "tblMembers". So far, the State portion of the script works as designed. In fact, the city portion also works as designed with the exception of one annoying problem.

    The portion of the script giving me a problem is the following line:

    City(i)= alltrim( " " + alltrim(tbl.state)

    For the life of me, I cannot figure out why placing a SPACE between the city and state fields results in the array coming up blank. If I eliminate the space in the line above, both fields are properly displayed in the array.

    Please Note: using a space in the state option works perfectly as follows:

    STATE(i)= alltrim(Ltbl.STATE) + " " + alltrim(Ltbl.Abbreviation)

    I'm sure there is something obvious I did wrong, but I cannot see my own mistake. The only difference that stands out to me so far, is the use of a LookUp Table for the State option while the City option uses table.current()

    Here is the portion of the script for the City option.

    case alltrim(Selection) = "City"

    'Make City the current index
    'This index sorts tblMembers by alltrim(City) + " " + alltrim(State)
    'Allow the User to Preview/Print a Report Filtered by City

    Dim Choice as C
    Dim Shared ChoiceCity as C
    Dim Nrecs as N
    Dim i as N
    Dim City(3000) as C 'Use a variable instead of 3000 later

    tbl = table.current()
    Nrecs = tbl.records_get()


    while .not. tbl.fetch_eof()
    City(i)= alltrim( " " + alltrim(tbl.state)
    end while

    Choice =ui_get_list_array("Select One City",1,"CITY")
    ChoiceCity = Word(Choice,1)


    Dim query.description as C
    Dim query.filter as c
    Dim query.options as c
    Dim query.order as c

    query.description = "Preview Rpt. by CITY"
    query.order = ""
    query.filter = "city = ChoiceCity"
    query.options = ""



  • #2
    RE: Array Puzzle?

    Inplace of this "City(i)= alltrim( " " + alltrim(tbl.state)"
    try "City(i)= alltrim( alltrim(tbl.state)"

    I find space(1) works when "" doesn't

    Have fun


    • #3
      RE: Array Puzzle?

      Hi Nick:

      Thanks for the repsponse. I should have stated in my question that I previously tried Space(1). Whether I used quotes or the Space()function, had no impact on the results.


      • #4
        RE: Array Puzzle?

        I just created a simple table with the fields and index you are trying to use and created a button on a table form to run the script segment you posted. The array comes up fine. I also put the script segment on the OnPrintInit event for a report and again the array comes up correctly. I can't see anything from what you posted that should be a problem. Have you tried database compact?

        Perhaps if you zip up the complete script or even a copy of the table and all of its related files, someone can find what is happening.



        • #5
          RE: Array Puzzle?

          I have found one problem with the script you posted. The query does not work. The filter expression does uses the wrong syntaxt. Change

          query.filter = "city = ChoiceCity"


          query.filter = "alltrim(tblMembers->city) = alltrim(var->ChoiceCity)"

          This will filter the records correctly.

          Another thought. If the index you are using is corrupted, the script may hang and not be able to create the array. You could try deleting the index and then recreating it.



          • #6
            Array Puzzle SOLVED !!!

            Hi Jerry:

            This discussion board is amazing, you solved my frustrating problem!!!!Before I talk about the solution, let me first thank you for the modification of my query filter. I must say the query filter was apparently working properly all along, however, I prefer your methodology, thanks.

            Before I posted my question to this site, I suspected the problem might be related to the index selected. Therefore, I went back, double checked the formatting of the index, and rebuilt each one. However, that did NOT solve the problem, so I assumed the cause of the array formatting problem lied elsewhere. In retrospect, that was a misguided assumption.

            After reading your suggestion, I realized there was an obvious alternative to test the index selected and see if it was the root cause. Unfotunately, I failed to consider this simple option before posting my question.

            Instead of rebuilding the indexes again, I merely changed the index in my script to record number order. And guess what Jerry? That resolved my problem, the array came up perfectly, with the desired space between city and state.

            I still don't understand why it didn't work with the CITY index because the formatting was exactly what I wanted in the Array.

            Thanks again, I love this Alpha discussion group.



            • #7
              RE: Array Puzzle SOLVED !!!

              Glad it's working. However, I set up an index called City with the same expression you indicated you were using and the array came up fine. If you open the default browse and set the index to City, does eveything show correctly? I am thinking you may still have a corrupt index, corrupt data, or some blank records. Also rebuilding the indexes by clicking on on the build button on the define indexes option may not correct an index problem. Did you try deleting the index completely, rebuilding the remaining indexes, compacting the database, and then recreating the original index?. If the index is indeed corrupted, this should eliminate the problem.



              • #8
                RE: Array Puzzle SOLVED !!!

                Hi Jerry:

                You might be right about the indexes being corrupt because I merely rebuilt them, I did not delete first and then rebuild. I'll give it a try a little later and let you know what happened.

                Thanks again,



                • #9
                  Indexes: Corrupted?

                  Hi Jerry:

                  You were also right on this point. The entire cause of the display problem was the index. Once that was corrected, the Array worked properly.

                  One last minor question. After I set the index to CITY, the records are ordered just the way I want them. After the Array is displayed in City & State order, and a City Variable is selected, the script subsequently runs a query where the order currently is " ".

                  I'm slightly confused on this one, it appears as if I am going back to Record Order as a result of the Query? Or is Alpha somehow smart enough to leave the CITY index active? Do I have to once again set up formatting in the Order portion of the Query?



                  • #10
                    RE: Indexes: Corrupted?

                    I usually specify the order in a query. Then it doesn't matter what index is in effect when it is run. If you set the query order exactly the same as the expression for an existing index there is not speed penalty since it will use Lightning Query Optimization. There is more info about that in both the users guide and the xbasic manual.