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

Total function confusion

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

    Total function confusion

    I've been away from Alpha for a number of years and had to re-register using a new name.
    The function below works fine to total "KWH" if "Hour" = "01-02" or "02-03".
    As soon as the next "Hour" {03-04} is encountered the total zeros.
    I believe that the false result "0" in RED is the culprit but I cannot find a null function.
    The help function indicates there is no way to identify a numeric null.

    if(Hourly->Hour = "01-02" .or. Hourly->Hour = "02-03",total(Hourly->Kwh,GRP->Group 1),0)

    Any suggestions

    #2
    Re: Total function confusion

    Looks like you have a statement that says simply if the hour = X or Y then hour = a formulas value, otherwise it equals ZERO and my guess is the zero's are simply the display format. The comma with the RED zero in tow - isn't that specifically stating that anything else is ZERO?

    Please also understand, that I am a total NOOB - so if my questions/comments are out of whack from what's really going on here kindly disregard...I tried.
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

    Comment


      #3
      Re: Total function confusion

      Originally posted by CharlesParker View Post
      Looks like you have a statement that says simply if the hour = X or Y then hour = a formulas value, otherwise it equals ZERO and my guess is the zero's are simply the display format. The comma with the RED zero in tow - isn't that specifically stating that anything else is ZERO?

      Please also understand, that I am a total NOOB - so if my questions/comments are out of whack from what's really going on here kindly disregard...I tried.
      The hours "01-02, 02-03...24-01 represent a 24 hour day. I simply want to total selected periods while ignoring the rest. The problem is that as soon as it encounters an ignored value it zeros the total.
      e.g.
      Hour KWH
      --------------
      01-02 2.0
      02-03 3.0 Total-5.0 OK {If there are only these two records}

      01-02 2.0
      02-03 3.0
      03-04 1.0 Total=0.0 Should be 5.0

      Thanks John

      Comment


        #4
        Re: Total function confusion

        It sure seems like you do not need an IF statement to ADD things. To me the IF statement means that there's an ELSE statement by default adn your default ELSE is "0"
        what happens if you add 07-08?
        If I am right its ZERO

        why not just add the values in a simple A+B statement or a summary value calculation? I think what would really be necessary is to say if this is a grid, UX, repeating section, list control, etc. because at this point it seems to me that all your trying to do is add up the values as they are entered. What are you working with?
        Again, the if statement is doing EXACTLY what your asking it to, IF - ELSE as per the value following the comma (ZERO)

        If anyone else sees this different - post up!
        NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

        Comment


          #5
          Re: Total function confusion

          OH - also this is the desktop area and I am outside of my area of Alpha usage! I am much more familiar with the webside - but regardless I still see that function as doing exactly what your telling it to!
          NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

          Comment


            #6
            Re: Total function confusion

            You are using this on a report? Otherwise GRP->Group 1 likely has no meaning.

            total(Hourly->Kwh,GRP->Group 1) does that. It doesn't care what your if statement wrapped around it does. Total() doesn't do filters.

            You probably need a tablesum() function something like

            tablesum("hourly","Hour = '01-02' .or. Hour = '02-03'","kwh")

            You could also define a calculated field for the report

            if(Hourly->Hour = "01-02" .or. Hourly->Hour = "02-03",kwh,0)

            and total that calculated field.
            There can be only one.

            Comment


              #7
              Re: Total function confusion

              Charles.

              Right you are. I'm trying to do the wrong thing.

              Stan

              You got it. I've been away from Alpha too long.
              Gotta get my head around it once again.

              Appreciate, John

              Comment


                #8
                Re: Total function confusion

                Well one down, one to go.

                I am working within a form, based on a set.

                Meter
                ..."==Daily {One record per day, per meter}
                ......"==Hourly {24 records per day, one per hour}

                As I am entering the 24 hourly records, the selected cumulative KW Hour totals are displayed on the form .{e.g. 9AM to 5PM = C_KWH917} and the total KW Hours {T_KWH}.

                Now the $64,000 question. How do I transfer these totals one level up to the appropriate DAILY record?

                Suggestions appreciated.

                PS. this used to be a cinch in A4 as it was set based.

                Comment


                  #9
                  Re: Total function confusion

                  You could have a posting field rule.
                  You could have a posting operation run the next day..
                  The daily fields could be calculated with a tablesum().
                  Last edited by Stan Mathews; 08-17-2016, 08:17 AM.
                  There can be only one.

                  Comment


                    #10
                    Re: Total function confusion

                    Originally posted by Stan Mathews View Post
                    You could have a posting field rule.
                    You could have a posting operation run the next day..
                    The daily fields could be calculated with a tablesum().
                    Good morning Stan

                    1. Tried posting rule but
                    .......IF choosing "ADD", then corrections add again and totals are too high
                    .......If choosing "REPLACE" then only this record is recorded.

                    2. Same issue if changes made later (Also see 3.)

                    3. Tried tablesum() but could not figure out the correct filter {variable?} to restrict it to the current DAY only.
                    I can re-specify all the filter details but was trying to tablesum() the previously calculated totaled HRS.

                    Thanks for replying.
                    John

                    Comment


                      #11
                      Re: Total function confusion

                      To restrict the tablesum() to the desired day there must be a day field in the hourly table.

                      Meter
                      ..."==Daily {One record per day, per meter}
                      ......"==Hourly {24 records per day, one per hour}
                      Probably need a sample database/set to see the fields and set linkages/linking fields..
                      There can be only one.

                      Comment


                        #12
                        Re: Total function confusion

                        Stan

                        There are matching dates in the HOURLY and DAILY records.

                        I've tried tablesum("Hourly","?????????","T_KWH0917") Where ?????? has been various forms of dates. I just can't nail it.

                        I'll try to put together a sample DB

                        Thanks John

                        Comment


                          #13
                          Re: Total function confusion

                          1. Tried posting rule but
                          .......IF choosing "ADD", then corrections add again and totals are too high
                          .......If choosing "REPLACE" then only this record is recorded.
                          Using a posting field rule you don't make corrections, only adjustments (+/-) or you make a correcting entry of the original amount negative and then a corrected entry. ADD is the correct choice.
                          There can be only one.

                          Comment


                            #14
                            Re: Total function confusion

                            tablesum("Hourly","date_field_name =" +s_quote(date_variable_name) ,"T_KWH0917")

                            but you need to add the meter designator to that as well so the sample is still needed.

                            Just a reminder since you've been away from Alpha for a while. Calculated fields are recalculated only when a value in the table where the calculation if defined changes, which will never happen here because the values changing are in another table. You will need to use one of the force recalculation options.

                            A5_RECALC_CALC_FIELDS()
                            <TBL>.RECALC_CALCFIELDS()

                            or

                            Right click on a table in the Control Panel, and select Utilities > Recalculate Calc Fields (Field Rules).

                            Or, click Table > Utilities > Recalculate Calc Fields (Field Rules).

                            Click OK.
                            Last edited by Stan Mathews; 08-17-2016, 09:45 AM.
                            There can be only one.

                            Comment


                              #15
                              Re: Total function confusion

                              Working on a sample. Been a while since I had to do this.
                              I'll have to figure it out.
                              Thank, John

                              Comment

                              Working...
                              X