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 by a Calculated Field in a Report

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

    Sorting by a Calculated Field in a Report

    I always thought that I could take a calculated field in a report and order the report by that field. This would allow me, for example, to take a calculated field such as "client_totals" and sort the field in ascending or descending order, which would then allow me to build a Top 10, Bottom 10 Report.

    Every time I try to do this though, the expression vanishes after I leave the detail setup area, leaving me with no sort order results.

    Would anyone know if sorting by a calculated field in a report is permitted in A5 v10 desktop? If so, does anyone have any suggestions?

    Thanks.
    Tom

    #2
    Re: Sorting by a Calculated Field in a Report

    Hi Tom,

    Where is the calculated field getting it's value from?
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


      #3
      Re: Sorting by a Calculated Field in a Report

      Tom, the term "calculated field" is susceptible to at least two different meanings. If you're referring to a table field that's been setup as a calc field in field rules, yes you can sort on that field. If you're referring to a calc display field you've defined in the report layout you cannot. This kind of makes sense to me. If you want the report engine to sort records based on the field's value then all the values must be available before the first line of the report is printed. A calc display field in a report layout is nothing more than a variable that is evaluated separately for each record in the report. There is no "list" of all the calc display fields that can be sorted before the first line in the report is produced.
      Last edited by Tom Cone Jr; 01-11-2011, 09:35 AM.

      Comment


        #4
        Re: Sorting by a Calculated Field in a Report

        Tom,
        If you have the latitude for having a field in the parent table for "rank", you could have a function run prior to the report that writes the calculated value into the rank field and have the report order on that "temporary field" to generate your rank. That's what I have done in the past very successfully for this type of situation.
        Mike W
        __________________________
        "I rebel in at least small things to express to the world that I have not completely surrendered"

        Comment


          #5
          Re: Sorting by a Calculated Field in a Report

          Thanks to all for the replies.

          First, Keith and Tom, I do have the calculated field within a report's parameters and you're right, the logic does make sense when I stop and think about it. The report calculation is an 'after the fact' calculation and you can't sort what you don't know initially.

          Second, Mike, I think that's a good idea. I'm guessing that I would put a field (rank) as you suggest in the client table. I would then have the xdialog ask the user for a date range and a number, i.e. top 5, top 10, top 20, etc. The script would initiate a calculation of revenue by client over the date range entered and would send the ranking to the 'rank' field. Then the report would run as normal but be ordered by the rank value.

          In short, what I'm trying to do is combine revenue from two different tables and then relate it to the variables that were entered in the xdialog, putting the results in ascending or descending order (depending on the choice of top 10 or bottom 10).

          Mike, I'd be grateful for any further advice you have on this subject. BTW, how is your app coming along?

          Tom

          Comment


            #6
            Re: Sorting by a Calculated Field in a Report

            Originally posted by [email protected] View Post
            The report calculation is an 'after the fact' calculation
            Yes... just as Tom said and explained it so well..
            BUT..
            Who said you can't fool alpha into doing things your way?!
            To make alpha do the calculation before hand, put the expression in a group, i.e.:
            Create a group and break on an expression, the expression is the same as you use in the calculation and you could make the order ascending or descending.

            Comment


              #7
              Re: Sorting by a Calculated Field in a Report

              Gabriel,
              Great idea! Tom, I would try Gabriel's idea first. If no joy, then to what I suggested, the "rank" would just be the value of the calculated revenue, and merely ordering by that field will naturally generate your ranking.

              As far as my app progress, there is always one at some stage of development. One was just recently uploaded to FTP server for web distribution and being trialed my the masses (ok not that many downloads at this point, but it's early). Thanks for asking.
              Last edited by Mike Wilson; 01-12-2011, 03:16 PM.
              Mike W
              __________________________
              "I rebel in at least small things to express to the world that I have not completely surrendered"

              Comment


                #8
                Re: Sorting by a Calculated Field in a Report

                It appears to me that Alpha does support ordering by calculated fields as long as they are not summary fields

                Comment


                  #9
                  Re: Sorting by a Calculated Field in a Report

                  The only way Alpha could sort on a total or subtotal field would be to make several passes thru the data.
                  I seem to remember on a much earlier version of Alpha, maybe all the way back to a5v1
                  there was a report option to make an initial pass thru the data prior to printing.Slowed thiungs down, but maybe made other things possible.

                  Comment


                    #10
                    Re: Sorting by a Calculated Field in a Report

                    Thanks Gabriel. I will definitely try your suggestion.

                    Comment


                      #11
                      Re: Sorting by a Calculated Field in a Report

                      I seem to remember a pre-calc run option in an early version of Alpha (Alpha 4?), can't find it in 10.
                      When I try to change my group 'break on change in' field to an expression that shows the # of records per group Alpha gives me an error messaging saying it can't be done.

                      Comment


                        #12
                        Re: Sorting by a Calculated Field in a Report

                        Jay,

                        I have it working thanks to Mike Christensen. If you're interested and have a similar need, you should contact him. Mike took Gabriel and Mike Wilson's earlier suggestions and made them work beautifully for me.

                        Thanks to all!

                        Tom

                        Comment


                          #13
                          Re: Sorting by a Calculated Field in a Report

                          Tom,

                          It would be good if you could share the result with us.
                          Regards
                          Keith Hubert
                          Alpha Guild Member
                          London.
                          KHDB Management Systems
                          Skype = keith.hubert


                          For your day-to-day Needs, you Need an Alpha Database!

                          Comment


                            #14
                            Re: Sorting by a Calculated Field in a Report

                            Basically, I had to remember how I had previously used a calc to determine the order in a report as it was some time since I had done so....using the tablesum() function as the calc field is how. And the order is then used in a Group with the tablesum.....it does not seem to work anywhere else but in a group. Tom did not have a group, nor did he need one....so I put one in anyway! :) I simply made the group's break on change an expression of 1=2 so that it would never change.

                            Note that using tablesum() may not be a good choice if a lot of records are present, but for Tom's case it should not present an issue.
                            Mike
                            __________________________________________
                            It is only when we forget all our learning that we begin to know.
                            It's not what you look at that matters, it's what you see.
                            Henry David Thoreau
                            __________________________________________



                            Comment

                            Working...
                            X