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

why tablesum() cannot summarize data correctly

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

    #31
    Re: why tablesum() cannot summarize data correctly

    Stan,

    I use the calculate field (not field rule) below.
    totalpaid = tablesum("act_rec_paid.dbf","member_id = "+quote(member_id.value)+" .and. month(paid_date) ="+month(date())+" .and. year(paid_date) = "+year(date()),"amount_paid")
    it works but it cannot calculate the previous records after I modified more condition.
    It calculate only new records.

    I try to add a button with below script
    Dim tbl as P
    Tbl = table.open("act_rec_paid.dbf")
    Tbl.recalc_calcFields()
    Tbl.close()

    It can see it run something progress but the result is remain the same (not calculate the previous records)
    I try the right clicking on the table act_rec_paid.dbf and Utilities > Recalculate Calc Fields. The result is it cannot calculate the previous records. However the new records is ok it can calculate with no problem.
    What I miss?

    Stan I asked you many times how much you will charge me.

    Thanks
    Peter-th

    Comment


      #32
      Re: why tablesum() cannot summarize data correctly

      Stan,

      I use the calculate field (not field rule) below.
      totalpaid = tablesum("act_rec_paid.dbf","member_id = "+quote(member_id.value)+" .and. month(paid_date) ="+month(date())+" .and. year(paid_date) = "+year(date()),"amount_paid")
      it works but it cannot calculate the previous records after I modified more condition.
      It calculates only new records.

      I try to add a button with below script
      Dim tbl as P
      Tbl = table.open("act_rec_paid.dbf")
      Tbl.recalc_calcFields()
      Tbl.close()

      I can see it run something progress but the result is remain the same (not calculate the previous records)
      I try the right clicking on the table act_rec_paid.dbf and Utilities > Recalculate Calc Fields. The result is it cannot calculate the previous records. However the new records is ok it can calculate with no problem.
      What I miss?

      Stan I asked you many times how much you will charge me.

      Thanks
      Peter-th

      Comment


        #33
        Re: why tablesum() cannot summarize data correctly

        Can you send me a zip of the table? (act_rec_paid.dbf)

        Zip it from the Alpha control panel so the support files are included.

        [email protected]
        There can be only one.

        Comment


          #34
          Re: why tablesum() cannot summarize data correctly

          Stan,

          I try to prepare the zip table and the related table for you to review but it's difficult for me I develop it in my local language I have to explain more and more for what is my menu, button, and data I key in field (all is local langquage) and takes time very long to convert in english.
          Is it posible if I ask you a short question and explain what I did same as I post on board and you may explain or have a sample with brief explaination and I can try myself and you can charge me what you spend time for my novice question.

          For my old question/problem now due to I have just 10 records , I empty the table and key in new data and the tablesum() can calculate correctly now.

          For the act_rec_paid.dbf I try to develop is for customer wha what to paid their debt for each previous month. Now I can use the tablesum() to receive and calculate the money from customers. Now I want to use the tablesum() to calculate each customer debt for each month when each customer bought goods from previous month and compare it for balance.
          Can I user tablesum() for set structure?

          I can create the button and report to see the debt for each customer with following command
          total(G1invoice_Items->Extension,GRP->GRAND)

          and filter with this
          Pay_method = "Coupon" .and. Member_Id = Var->debtor .and.
          month(Date) = month(Var->today) .AND. year(Date) = year(Var->today)
          I can use the above report because I can use only with Invoice Items table and use filter
          for all invoice for each member id

          Is it posible I can use tablesum() for set structure for my Invoice header (same as AlphaSport) to check the debt for all invoice for each customer by key in the member_id

          Thanks
          Peter-th

          Comment


            #35
            Re: why tablesum() cannot summarize data correctly

            something like (but not work)
            debtthismonth = TABLESUM("G1invoice_header.dbf","member_id="+quote(Member_Id.value),"Extension")

            Comment


              #36
              Re: why tablesum() cannot summarize data correctly

              Code:
              debtthismonth = TABLESUM("G1invoice_header.dbf","member_id="+quote(Member_Id.value),"Extension")
              In AlphaSports the "extension" field is in the invoice_items table, not the invoice_header table. Did you want

              Code:
              TABLESUM("G1invoice_items.dbf","Invoice_Number="+quote(Invoice_Number.value),"Extension")
              There can be only one.

              Comment


                #37
                Re: why tablesum() cannot summarize data correctly

                Stan,

                Due to I want calculate the summarize of Extension for all invoice for each member so I want to filter both member id and invoice.

                If I use below expression, I cannot calculate for each member
                TABLESUM("G1invoice_items.dbf","Invoice_Number="+quote(Invoice_Number.value),"Extension")

                Can I use tablesum() for set? and filter both member id and invoice number , like
                tablesum("G1invoice_set", "Invoice_number="+quote(Invoice_number.value) .and.
                "member_id="+quote(member_id.value),"Extension")

                Thanks
                Peter-th
                [email protected]

                Comment


                  #38
                  Re: why tablesum() cannot summarize data correctly

                  Hi Peter,

                  Have a look at DBSUM().
                  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


                    #39
                    Re: why tablesum() cannot summarize data correctly

                    Hi Keith,

                    I want to do a form has a calculate field. First calculate the money customer paid (I can did now with tablesum() ) . Second calculate the debt of each member id calculate from Invoice header and Invoice items (structure same as Alpha Sport) and Third field to balance it.

                    The problem is I cannot calculate the debt of each member id (when I key in the member id ) from Invoice header and Invoice items.
                    However I can use total() calculate the debt of each member id from report and fileter the record I want to know the debt each month each member.

                    But I stuck how to calculate the debt of each month and each member id from Invoice header and invoice items

                    the tablesum() can support for set structure?
                    I will try the DBSUM() for this

                    Thanks
                    Peter-th

                    Comment


                      #40
                      Re: why tablesum() cannot summarize data correctly

                      the tablesum() can support for set structure?
                      I will try the DBSUM() for this
                      No and no. Tablesum() and dbsum() both require that you name the table from which the field is to be summed. Sets are not a suitable parameter.
                      There can be only one.

                      Comment


                        #41
                        Re: why tablesum() cannot summarize data correctly

                        Stan,

                        Please see the attached files.
                        How can I sum the debt or Extension of all invoice of each member id in Receive Money form.


                        Thanks
                        Peter-th

                        Comment


                          #42
                          Re: why tablesum() cannot summarize data correctly

                          The grand total debt should be.

                          Code:
                          TABLESUM("G1invoice_items.dbf","Member_id="+quote(member_id.value),"Extension")
                          There are no dates in the G1invoice_items.dbf so there is no way to filter for a particular month.
                          There can be only one.

                          Comment


                            #43
                            Re: why tablesum() cannot summarize data correctly

                            Stan,

                            The problem is.. it has no value of member id in Member_id field of G1invoice_items. I can create Member_id field but the member_id value cannot post from G1invoice header table to G1invoice_items. The G1invoice header and G1invoice items has related with set..
                            Actually if I can post the data of Date and Member id from G1invoice header table to G1invoice items table and then the G1invoice items has data both date and member id so I can use Tablesum() only with G1invoice items.

                            I try to use edit field rule of Memberid of G1invoice items table by set to calculate field
                            (memberid = member_id field of G1invoice_header) and then I can see the expression like this below
                            LOOKUP("g1invoice header","INVOICE_NO="+CHR(34)+INVOICE_NUMBER+CHR(34),"g1invoice header->Member_Id")

                            When I key in the member id in form the member id is filled in the member_id of G1invoice header but it has no member id in the G1invoice items

                            The all application I develop is 150MB I'm not sure it is included the backup or not.
                            Usually it should not be big. My data is around 60-80 records. How can I send you the relate table/form.

                            Please advise.
                            Peter-th

                            Comment


                              #44
                              Re: why tablesum() cannot summarize data correctly

                              Stan,

                              There is any way to past or post data from Parent table (G1invoice header) to child table (G1invoice items)
                              I want to past the value of Date field and Member id field from G1invoice header to Date field and Member id field of G1invoice itmes (now I created Date and Member id field of G1invoice items)
                              but I found it parent-child table and value of date and member id from parent cannot past to chile

                              If I has value of Date and Member id in G1invoice items so I can calculate debt for each member during a month with date and member id.

                              Please advise
                              Peter-th

                              Comment


                                #45
                                Re: why tablesum() cannot summarize data correctly

                                Before you send anything, while viewing the control panel use the File menu, Database Compact choice. This should reduce the database size.

                                You can post the member id and date to the g1invoice_items table with this script as the cansaverecord event code (field rules) for the g1invoice_items table. You must add the fields member_id and date to the table first.

                                Code:
                                if is_object(invoice")
                                tbl = table.current()
                                tbl.member_id = member_id.value
                                tbl.date = date.value
                                end if
                                There can be only one.

                                Comment

                                Working...
                                X