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

Sort of different

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

    Sort of different

    I need to sort a list in human language rather than computer, and my brain is stalled. The GS/GSD/GSB can be in a different order, but the 1, 2, 3..., 10, 11A, 11B 1part has me stumped. I've attached the table rather than try to describe it.

    I've managed to sort the list by assigning other values (9 BA 2 for GSA 11A 2) for lookups, but we want the operator to be able to Find by key "GSA 10" and page up or down in a form.

    #2
    RE: Sort of different

    sorry 'bout that

    Comment


      #3
      RE: Sort of different

      Sandy,

      I think I see your problem even if I don't see your table. There is an inconsistency in the way your data is structured which is causing your sort problem.

      1, 2, 3..., 10, 11A, 11B

      should be 01, 02, 03..., 10, 11A, 11B, or 001, 002, 003..., 010, 011A, 011B if you want to allow for higher values. Then a sort on the field would be in the order I think you want. If I understand, you are getting sorts with "GSA 10" prior to "GSA 2", which is alphabetically correct.

      Since it seems your character prefix can be two or three characters and you may have a character postfix, trying to pick apart the expression with left(), right(), etc could get verrrrrrrry tricky.

      Have you considered splitting this field into it's three components, i.e. a field for the prefix, a field for the number, and a field for the postfix? You could then sort more easily, yet still concatenate the parts when you need the "real" value.

      Stan
      There can be only one.

      Comment


        #4
        RE: Sort of different

        You are quite right about where the sort is going wrong and obeying the alphabet instead of what the ID system's author intended. The trouble comes when a user wants to find one of these things. There is a button with a script

        PARENT.index_set("NHPC")
        topparent.find()
        end

        The users know the names as GSB 2A 2 (or such), so I have to do the translating. There is an index that works (built on 1 2A 2 instead), but they would still need to enter the GSB 2A 2 in the find box.

        Comment


          #5
          RE: Sort of different

          Sandy, I have attached your DBF along with the support files and an index. I THINK I've got what you want. Checking the browse, GSA 9 1A sorts before GSA 10 1A. I also included a form on which I put a FIND button. To make this work, I prompted the user 3 times (once for each component of the code). That's not as convenient as it could be, but it seems to work. If nothing else, it might be a starting point that you can expand on.

          Comment


            #6
            RE: Sort of different

            Sandy, don't overlook the possibility of using a non-indexed find by text routine. If your list is not overly long performance should be just fine. While a bit slower it will be much easier to implement that indexed translation tables, or so it seems to me.

            In fact, if the list is relatively static you might load the whole darn thing into an array which could be searched by brute force quite quickly.

            -- tom

            Comment


              #7
              RE: Sort of different

              It works!

              if val(b)

              Comment


                #8
                RE: Sort of different

                We need the list in order because we are usually guessing when we look something up. We might try a Find for GSA 9 and then Page Down until the feature we needed showed up on GSA 10B 1 - if GSA 10 has a B and/or a 1.

                Would an array be helpful? The table is so static it's positively boring.

                Comment


                  #9
                  RE: Sort of different

                  Dear Sandy,

                  I believe that the following will do what you want.

                  Create an index named "order" and use the expression "remspecial(gsusa)"

                  Then create a button on your form. I've attached a text file with the Xbasic syntax for the button. Hope this helps!

                  Comment


                    #10
                    RE: Sort of different

                    In my prior post (and included in the text file) I suggested using the index expression "remspecial(gsusa)". Actually, the remspecial should be left off in the index expression and should simply be "gsusa". The Xbasic on the button is the same.

                    Comment


                      #11
                      RE: Sort of different

                      The basic trouble remains - gususa doesn't sort correctly. GSA 10 needs to come after GSA 9 - which is most illogical to the program. I think Bill is on the right track, but I need to pull all the items apart and pad them with spaces or zeros.

                      "Word" looks promising, but I have a bit more reading to do.

                      Comment


                        #12
                        RE: Sort of different

                        Sandy, check out the ui_get_list_array() function. It might be a good choice is your list is not too long, and doesn't change much.

                        -- tom

                        Comment


                          #13
                          RE: Sort of different

                          Wild thought late this evening.

                          Define an index on your sortlist field:

                          SUBSTR(GSUSA,3,8).

                          This index looks like what you want except for

                          GSA 3 1
                          GSA 3 10
                          GSA 3 11
                          GSA 3 2

                          Maybe your users could live with this.

                          Best I can tell everything else sorts correctly.
                          There can be only one.

                          Comment


                            #14
                            RE: Sort of different

                            Wilder thoughts later...

                            If your list of GS.... items is static, build it once sorted as they want, in record number order, no indexes.

                            If the list is infrequently changed, build the list, sorted as they want, in Excel, design an import, let them make changes in Excel and reimport as desired, no indexes.
                            There can be only one.

                            Comment


                              #15
                              RE: Sort of different

                              Sandy and All,

                              A basic rule of database design is that you always want to control the user's input from the way they like to do things to the way it needs to be done internally.

                              In a find by key for a simple field, they might bring up the index selection, change the index, then bring up the find by key dialog box, start typing text and do the find.

                              But, since, as a database designer, you might want to rename the index name, or change the index expression, or other such changes as the design requires, you always want the user to pass through your code, even, if you do what amounts to nothing but pass the values through. That way, if you do make a change, the user does not percieve any operation change, even if you manipulate his input along the way.

                              For your case, the index expression should be something like;

                              PADR(WORD(GSUSA,1),5," ")+PADL(WORD(GSUSA,2),3," ")+PADL(WORD(GSUSA,3),2,"")

                              This provides the sort that you want (or something close - the final expression is left up to you). Now when the user inputs something, they are not (and probably will not) remember to put in the correct number of spaces (nor should they have to). That means that you need to take their input and apply the same translation to get the key value and then do the find-by-key.

                              Their input could be 1 input that you parse, several separate values that you concatonate or even radio buttons, but whatever your dialog boxes get from them, you have to translate it to your index expression.

                              I have attached your database with a simple form with a button that has some sample code. Look at the index definition for the table as well.

                              Alpha 5 (current version 4.5 and earlier) may not always permit you to have your code executed because there may be places that you can't customize (possibly lookup tables in the field rules, print preview etc) and that's a problem, but there are often ways to get around these problems if you work at it.

                              Another point I'll mention is that many times you want a table to be sorted a particular way that has no appropriate expression that can be derived (for me this is most typically the most likely records 1st, least likely last). When this occurs, I add an "order" field to the database that I index to force the order to whatever I desire. The user never sees this index or field, but it controls what they see.

                              Regards,

                              Ira J. Perlow
                              Computer Systems Design & Associates
                              [email protected]
                              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