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

avg a field on a form with num/char data

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

  • avg a field on a form with num/char data

    I need to get the average aging for the currently selected records in a form. The following would work:

    Code:
    val(Setage)/Var->vngSrchCount
    Except that the Setage field is actually a calculated field set as follows:

    IF(.NOT.ISBLANK("Date_out"),"Shipped",ALLTRIM(STR(DATE()-DATE_IN)))

    What I need to do is look at the Setage field in all the resulting searched records that do NOT have "Shipped" in them, total those records only, and then divide them by the vngSrchCount.

    Unfortunately I can't seem to wrap my mind around the proper logic needed here :( Any ideas?

    Addl comment:

    I created a new calc field on my layout:

    Code:
    Setage = ALLTRIM(STR(DATE()-DATE_IN))
    This will eliminate the issue of worrying about "Shipped" being involved. I am working on convincing the client of pulling out the table level calc field as I see no need to have to store this value.

    The above val(Setage) formula that I referenced does not work. It returns zero regardless of the value in the form level calc field. So I still need to find a way to average this and I cannot seem to get it to work with a calc field :(
    Last edited by Cheryl Lemire; 12-22-2007, 10:38 PM.
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

  • #2
    Re: avg a field on a form with num/char data

    Originally posted by Cheryl Lemire View Post
    I need to get the average aging for the currently selected records in a form.
    ....
    What I need to do is look at the Setage field in all the resulting searched records that do NOT have "Shipped" in them, total those records only, and then divide them by the vngSrchCount.
    See if this works

    Since ultimately the test for setage having "Shipped" in it or the number of days is Date_out being blank I used Date_out in the expression.

    This will apply to the current record set for the form.
    avg = (total(If(isblank("Date_Out"),date()-Date,0)))/total(if(isblank("Date_out"),1,0))
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

    Comment


    • #3
      Re: avg a field on a form with num/char data

      Thanks Tim. That is really close. A search I did had two records where the setage value is 1014, so the avg for the 2 should be 1014 and your expression returned 1016. What am I missing?
      Cheryl
      #1 Designs By Pagecrazy
      http://pagecrazy.com/

      Comment


      • #4
        Re: avg a field on a form with num/char data

        2 :)

        EDIT: sorry couldn't resist that one. But seriously now. Is it possible that your setage field being a calculated field is uptodate as of two days ago and the avg calc is calculating upto today. You might need to do a recalc. ;)
        Last edited by Tim Kiebert; 12-23-2007, 12:43 AM.
        Tim Kiebert
        Eagle Creek Citrus
        A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

        Comment


        • #5
          Re: avg a field on a form with num/char data

          Tim,

          You were correct. But now I have to throw a monkey wrench into your expression. I need to now create this average using a calc field at the form level instead of table level as I fully intend to convince the client to remove the table calc field.

          Do you know how I would do that?
          Cheryl
          #1 Designs By Pagecrazy
          http://pagecrazy.com/

          Comment


          • #6
            Re: avg a field on a form with num/char data

            Cheryl,

            That is where the expression i posted was meant to go. :)
            Tim Kiebert
            Eagle Creek Citrus
            A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

            Comment


            • #7
              Re: avg a field on a form with num/char data

              Hi Tim,

              Now I am confused then. Why should I have to recalculate calculated fields in field rules to get the correct result?
              Cheryl
              #1 Designs By Pagecrazy
              http://pagecrazy.com/

              Comment


              • #8
                Re: avg a field on a form with num/char data

                The expresion I posted no matter from where it runs -(although I am a bit surprised that it worked at the table field rule level - because the total() function is usually only safe when used in at the layout level.)- always results in the most uptodate value because date() is evaluatd at run time. The setage field value also uses date() but is evaluted at the time the calculation is done - either at record creation or change or recalc. So the recalc you ran did not bring the avg expression into line but rather it brought the setage field uptodate.
                Tim Kiebert
                Eagle Creek Citrus
                A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                Comment


                • #9
                  Re: avg a field on a form with num/char data

                  OK, I must be too tired because I am getting more confused as we go along. I put your expression as a calc field on my form and not in the table. Your expression does not seem to have anything to do with the setage field in the table or on the form, which is why I have no idea why my recalculating the table calculated field rules gave me the correct result, but I did not get the correct result right away.

                  I will look at it again tomorrow.
                  Cheryl
                  #1 Designs By Pagecrazy
                  http://pagecrazy.com/

                  Comment


                  • #10
                    Re: avg a field on a form with num/char data

                    I have read and re-read the docs on total() and cannot figure out what the '1' and '0' mean in your expression. Care to elaborate for me? Thanks.
                    Cheryl
                    #1 Designs By Pagecrazy
                    http://pagecrazy.com/

                    Comment


                    • #11
                      Re: avg a field on a form with num/char data

                      Originally posted by Cheryl Lemire View Post
                      OK, I must be too tired because I am getting more confused as we go along. I put your expression as a calc field on my form and not in the table. Your expression does not seem to have anything to do with the setage field in the table or on the form, which is why I have no idea why my recalculating the table calculated field rules gave me the correct result, but I did not get the correct result right away.

                      I will look at it again tomorrow.
                      Ok. Just stay away from that kitchen wall.

                      Your right it does not have a direct connection to the setage field. But the test to use date()-date or 0 in the expression is based on Date_out being blank or not. Since you are testing the blankness of Date_out in the setage calc both the expression and the setage field are based on the same raw materials so to speak.

                      To avoid further confusion mybe you could provide a sample so we are both working with the same thing.
                      Tim Kiebert
                      Eagle Creek Citrus
                      A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                      Comment


                      • #12
                        Re: avg a field on a form with num/char data

                        Geeesh, the 1, 0 are for the isblank and not the total().

                        And I figured out why I 'thought' the expression did not work until after I recalculated the calc fields in the table. I was looking at the setage field in my browse (which is based on the table) to determine what my result should have been.

                        The result was always correct. I was looking at an incorrect number to determine what the result should have been.

                        Thanks for your patience and help with this issue Tim :)

                        BTW, I liked your 2 :) post better before the EDIT :D

                        Later: As far as the kitchen wall is concerned, it is my goal to get so many holes in the kitchen walls to force myself to get the remodel done sooner than later. Sooooo, the more I develop, the faster I will get the kitchen remodeled :)
                        Last edited by Cheryl Lemire; 12-23-2007, 02:05 AM. Reason: later
                        Cheryl
                        #1 Designs By Pagecrazy
                        http://pagecrazy.com/

                        Comment


                        • #13
                          Re: avg a field on a form with num/char data

                          Originally posted by Cheryl Lemire View Post
                          I have read and re-read the docs on total() and cannot figure out what the '1' and '0' mean in your expression. Care to elaborate for me? Thanks.
                          That is done to arrive at a count of records that have the date_out field blank. The total function does not have a filter so it adds up all the records in the form. The '1' and '0' are not actually in the total function but in the IF() function. If date_out is blank it has not been shipped so a 1 is assigned otherwise a 0 is assigned. The total function adds up all the 1s and 0s which results in the number of records in the form that have not been shipped.

                          Oops, to slow you already worked it out. Sleep well.
                          Tim Kiebert
                          Eagle Creek Citrus
                          A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                          Comment

                          Working...
                          X