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

Sorting a report by address

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

    Sorting a report by address

    I need to sort a report by address. The problem is that if I just use the address (street) field, the numbers of the streets appear first (such as all streets that start with 100).

    What I need to do is split the field at the first space, flip the field and sort by street name. Then a secondary sort by ADDRESS gives me the address sort.

    I could do this with other report writers, but I can't figure out how to write the variable to do this with Alpha5 v.4

    Hope someone knows the formula

    #2
    RE: Sorting a report by address

    Ron,

    No magic here, just a bit of twiddling with some of Alpha Five's string functions.

    From the interactive editor:

    Code:
    Address = "1234 Main St."
    
    ?isdigit(substr(Address,1,1))
    = .T.
    
    ?at(" ",Address,1)
    = 5.000000
    
    ?right(Address, len(Address) - at(" ",Address,1))
    = "Main St."
    
    ?left(Address, at(" ",Address,1) - 1)
    = "1234"
    
    
    SortAddr = if(isdigit(substr(Address,1,1)), right(Address, len(Address) - at(" ",Address,1)) + left(Address, at(" ",Address,1) - 1), Address)
    ?SortAddr
    = "Main St.1234"
    
    Address = "P.O. Box 111"
    ?SortAddr
    = "P.O. Box 111"
    An alternative that might be more useful in the long run would be to split the field into its components storing the number in a separate field from the street name. I believe the Update Operation Genie can help you do this if you want.

    Let me know if you have trouble deciphering the expression.

    -- tom

    Comment


      #3
      RE: Sorting a report by address

      I'll try it right away.
      For general information, I do have a second field where non street addresses are put (P.O., secondary headers etc). But it is not only much easier to keep the street address in one field, but I often have to input hundred of companies -- and the source always has it as one field.

      I might note that I have always used a SORT field. This is a six character field where I put the sort for the company. That way I can deal with all the problems (names with 'the', too many that start with New England etc). It is not hard to input (I default to the COMPANY field), but has proven to be invaluable.

      Thanks for your help.

      Comment


        #4
        RE: Sorting a report by address

        Tom,

        Sorry. I'm more of a doofus at this than I thought.
        Where do I enter the information for the new variable. The edit structure doesn't seem to allow for a definition.
        Then do I simply indicate this as an index? And do I have to set the index before going into the report, or can the report be always indexed the same way?

        Comment


          #5
          RE: Sorting a report by address


          I suggest you spend some time in ch. 10 of the User's Guide, especially in the section on Ordering and Selecting records.

          In the meantime,

          Open the report in design mode;
          Click Report menu;
          Choose Detail Properties;
          Choose Records tab;
          Enter the expression in the 'Order Expression' field. This will control the sequence of the report's details region.

          You will need to modify my expression so that instead of referring to a memory variable called 'Address' it refers instead to the address field in your table.

          I'm sorry. Thought this was obvious since your question indicated considerable experience with databases and string manipulation. I was trying to illustrate how to use Alpha Five's string functions to manipulate an address which contained both a street number and a street name, since that's what it sounded like you needed. I was not trying to write an expression that would work 'as is' in your report. If you still need help after studying the references I've mentioned let us know, and upload (attach) a working model of your database. We can show you how to fix it, assuming you also tell us which report you're working on...

          -- tom

          Comment


            #6
            RE: Sorting a report by address

            I realize that my manual is for the original Alpha5 (cir. 1994). So I am using the electronic version to see if I get better results.

            In the meantime I found the place to enter the expression. When I evaluate it tells me I am missing a right parenthesis. When I try putting one in the logical places, it tells me it is the wrong kind of data.

            Here is the expression. The field names are fine.

            Sortaddr
            if(isdigit(substr(Address,1,1)), right(Address, len(Address) - at(" ",Address,1)Address

            Comment


              #7
              RE: Sorting a report by address

              Ron,

              Looks as though you didn't scroll over far enough to the right to see the end of my expression. Your's looks incomplete.

              -- tom

              Comment


                #8
                RE: Sorting a report by address


                Your Order Expression should begin with

                if(


                and end with


                address)


                the 'SortAddr =' must of course be omitted.

                -- tom

                Comment


                  #9
                  RE: Sorting a report by address

                  When I try to preview the report I am still getting:
                  "Argument is incorrect data type"

                  I have been reading chapter 10. It says I can keep the detail data together without a page break. Simply choose that option in the Detail Properties dialogue box. I can find no such option.

                  Comment


                    #10
                    RE: Sorting a report by address

                    Ron, it should not be so complicated.

                    How about showing us the complete expression exactly as you're typing into the Order Expression box on Detail Properties of the report layout. ?

                    -- tom

                    Comment


                      #11
                      RE: Sorting a report by address


                      Ron, another idea, would be for you to zip a copy of your database together, and attach it to a reply here. Tell us which report you're working on, and we'll see if we can suggest the fix.

                      -- tom

                      Comment


                        #12
                        RE: Sorting a report by address


                        Ron,

                        Looks as though the user's guide is pointing you to the wrong dialog box.

                        Try:

                        Report
                        Region Properties
                        Detail
                        Region

                        You'll find the checkbox there to 'Keep region together'.

                        -- tom

                        Comment


                          #13
                          RE: Sorting a report by address

                          Select Report. Design.
                          Report Tab. Detail Properties.
                          Records. Order Expression.

                          if(isdigit(substr(address,1,1)), right(Address, len(Address) - at(" ",Address,1)Address)

                          If I do evaluation or try to run preview I get the notice that the argument is incorrect data type.

                          Comment


                            #14
                            RE: Sorting a report by address

                            Ron,

                            your expression is not complete and contains typos.

                            see the attachment to this message, which contains the full expression I posted originally.

                            -- tom

                            Comment


                              #15
                              RE: Sorting a report by address

                              if(isdigit(substr(Address,1,1)), right(Address), len(Address) - at(" ", Address,1)) + left(Address, at(" ",Address,1) - 1), Address)

                              For some reason I can't get anything from Alpha forum to wrap. It looks like I have it all now.
                              But now I get the message that there is a bad character. Do you see anything I typed wrong?

                              Comment

                              Working...
                              X