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

Percent of Counts in Reports

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

    Percent of Counts in Reports

    This should be quite simple but I am having trouble recreating a simple percentage value in A5 reports.

    In Alpha 4, you could get a count of a field then create a percentage by setting a calculated field like this:
    (SUMMARY->field3_GC/RECCOUNT())*100
    This worked great, as long as the report was based on the entire table, hence reccount().

    If I try a similar thing in Alpha 5
    (val(Calc->Cnt_Field3_For_Field3)/reccount())*100

    The report result just shows the "name" of the calculated percent field rather than the result!

    Is there a nother method I should be using, am I doing something daft.
    Chris Tanti
    Technical Support

    Nuance & Fathom Ltd - The data-driven marketing agency

    #2
    RE: Percent of Counts in Reports

    Alpoha displays the name of the field on a report, or any layout, if it can't understand how to perform the calculation.

    Yours should be

    (val(Calc->Cnt_Field3_For_Field3)/count(field3,GRP->Grand))*100
    There can be only one.

    Comment


      #3
      RE: Percent of Counts in Reports

      Stan,

      Ime afraid this does not work for me,

      The count field is a character string and does not want to be converted to a numeric! If I use val I get an incorect argument type.

      If I just creat grp->grand by itself in a field and try and convert that to a number that does not work either.

      This is a pain!!
      Chris Tanti
      Technical Support

      Nuance & Fathom Ltd - The data-driven marketing agency

      Comment


        #4
        RE: Percent of Counts in Reports

        Chris,

        I suspect the problem lies in what you are trying to "Count". Normally, A5 distinguishes very well as to whether the result of a calculated field on a report is numeric or character.

        Are you just counting a field or the result of an expression involving that field?
        For instance, "count" should work just fine with each of these expressions

        Field3""
        Field3>0
        Field3=.T.

        depending on whether the field is character, numeric, or logical. "Count" seems to need the result of a conditional expression like Field3"", counting those records that evaluate to "True".

        Are you using the genie that pops up when you drag a onto your report? This is much more foolproof than trying to directly type in a calc field expression using "Count" or "Total". I have to create calculated fields for percentages all the time. I create the numerator and denominator as separate calc fields via the genie. After you drag the on the report and create the numerator or whatever, you can delete it from the report section to which you dragged it. It will still remain as a calculated field unless you delete it from the Calc dialog window itself. Once the numerator and denominator calculated fields are created, you can either

        1. create a third calc field in the Calc dialog window that derives the percentage as you did in Alpha Four, or

        2. take the expressions for your numerator and denominator and combine them in a third calc field that derives the percentage, then delete the original numerator and denominator calc fields.

        I usually do number 1 since it makes it easier for me to track what the calc fields are doing later, despite the fact that it gives me more calc fields than necessary. A5 never seems to mind doing hundreds of calculations, although with a lot of records, the report will not be instantaneous.

        If you haven't relied on the genie, you may want to give it a try.

        Comment


          #5
          RE: Percent of Counts in Reports

          I am not sure this is what yiu want but here it is.

          1. Set up a numeric field say N
          2. Assign 0 to it as a default.
          3. Create and save an update operation that changes
          all values N to 0
          4. Using a Xbasic script loop through records changing N
          to 1 based on some selection criteria.
          5. Create a global variable, say TOT
          6. Set TOt = to thr total of N (I am not sure what the total() is)
          7. Loop through again to compute your percentages based on TOT
          but only for records where N=1. The other percentages can
          be set to zero.

          Instead of 6. it may be simpler to compute TOT as you loop
          thru the records, ie TOT=TOT+1

          Caveats: You may want to creste a temp table, say TEMP, and
          append to it the records from your table where N=1.
          Then you can compute your percentages in that table and
          do your reports from TEMP

          This looks more complicated than it is.
          In any events, it may give you some ideas.
          The key here is to creste the field N and use the total()
          function instead of the count() function.

          Comment


            #6
            RE: Percent of Counts in Reports

            Wow,

            I am getting the impression it would be a good idea for A5v5 to take a few pointers from A4 when it comes to percentage counting. It was a two second excercise in Alpha 4!!.
            Chris Tanti
            Technical Support

            Nuance & Fathom Ltd - The data-driven marketing agency

            Comment


              #7
              RE: Percent of Counts in Reports

              On the other hand, Alpha5 is a far superior
              product. There is a learning curve but well
              worth it. If you zip up your app, including
              a description of what percntages you are
              trying to get and what kind of report(s)you
              need, someone will help you solve your problem
              and even give the Xbasic code (if necessary)

              Comment


                #8
                RE: Percent of Counts in Reports

                Thanks for the offer Selig,

                Its not that I am critisising A5, I think Its great and I ejoy creating apps with it. It just seems like a shame that a previous (infereior!) product could do something so simply and this was lost in the upgrade.

                I would still like to know why I cant change a count field that is a character type to a numeric type with val.

                This is all I need to do.
                Chris Tanti
                Technical Support

                Nuance & Fathom Ltd - The data-driven marketing agency

                Comment


                  #9
                  RE: Percent of Counts in Reports

                  If the val() function returns an "incorrect argument type" error, then most likely the calc field is already a number.

                  I assumed that your original expression was correct except for the "grouping" and thus the

                  count(field3,GRP->Grand)

                  that I suggested.


                  Now I realize that

                  val(Calc->Cnt_Field3_For_Field3)

                  is like evaluating

                  val(9), doesn't make sense.

                  Sorry I didn't see that earlier.
                  There can be only one.

                  Comment


                    #10
                    RE: Percent of Counts in Reports

                    Nope, sorry Stan,

                    I am getting a count of a text based field, field3 as an example. The report has its grouping level set to field3, and on the footer of this group I drag field3 and genie it as a count (the count of the text field). If you look at the properties of the count field you will see that it is text based, you can only do case conversion on it, not the normal numeric formating like specifing whether its a curency field etc.

                    Now if you go to the calculated field options and say add 100 to the count expression and evaluate it, it seems to be correct, implying that its a numeric field. Run the report and it comes up with and incorect argument error. Implying that its a character field.

                    If you go to the calcualted field options and add a character string to the count expression then try and evaluate it it comes up with an error imeditally.

                    What is the calcualted count, it can't seem to make its mind up whether its numeric or character based. If you used the genie to create a total of a numeric field this is correctly created as a numeric field and you can do all the usual numeric type functions.

                    You should be able to do the same with counts.

                    Or is it just me.
                    Chris Tanti
                    Technical Support

                    Nuance & Fathom Ltd - The data-driven marketing agency

                    Comment


                      #11
                      RE: Percent of Counts in Reports

                      I can't duplicate your results. When I drag any field onto a group or report footer or header, specify "count", and right click, properties, in the dialog box, format, it defaults to right, top alignment, no wrap, width 8, decimals 0, "none" for style.

                      Experimented with numeric, character, and logical fields. Is this the way you are approaching the problem?
                      There can be only one.

                      Comment


                        #12
                        RE: Percent of Counts in Reports

                        Stan,

                        Ok, now drop down the format style, were it says none, you should find the only options you have are all case based
                        ie All Uppercase, All Lowercase etc.
                        Chris Tanti
                        Technical Support

                        Nuance & Fathom Ltd - The data-driven marketing agency

                        Comment


                          #13
                          RE: Percent of Counts in Reports

                          Stan,

                          Basically the "problem" occurs when you try and count a character based field in a group. The resulting calculated field is in a half way house, neither character nor numeric. If the same is tried, counting a numeric field, then the resulting calculated field is fully numeric.

                          Doesnt any one else think this is odd!!!
                          Chris Tanti
                          Technical Support

                          Nuance & Fathom Ltd - The data-driven marketing agency

                          Comment


                            #14
                            RE: Percent of Counts in Reports

                            Sorry, mine has the normal numeric formats with () $ etc, no matter whether the original field being counted is character, numeric, or logical, and the 'decimals shouldn't show 2 for a character field. I'll keep trying to see what I can find.
                            There can be only one.

                            Comment


                              #15
                              RE: Percent of Counts in Reports

                              Still stumped. Whatever field or calculated field you drop into a footer and specify count, the resulting calc field should be numeric. The alternative defies understanding.

                              Could you
                              1. open your report in design mode
                              2. from the drag drop list, select your "field3"
                              3. drop it into a footer
                              4. specify "count"
                              5. right click on the new field in the footer
                              6. copy the "expression" that appears in the dialog
                              7. post it as a reply here?

                              I feel we must be looking at two different things and thinking we're looking at one.

                              Thanks,

                              Stan
                              There can be only one.

                              Comment

                              Working...
                              X