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

Invoicing totals

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

    Invoicing totals

    Alpha sports uses group calculations for deriving the invoices totals and balances, on their invoice form. Other than using posting in field rules to stored fields ( subtotal, Total, balance etc.) what other methods are available not using stored fields?

    #2
    Re: Invoicing totals

    Tablesum(), tablecount(), etc
    Dbsum(), dbcount(), etc
    There can be only one.

    Comment


      #3
      Re: Invoicing totals

      Do they have to be used at the set level, or can they be used at the table level in field rules?

      Comment


        #4
        Re: Invoicing totals

        Must be used at the table level. There are no set equivalents.

        They can be used in the field rules but I would suggest you work with the dbsum() etc for that. Much faster.

        I always question why it is necessary to store such information in a table when the results are always obtainable with a calculated field in a layout.
        There can be only one.

        Comment


          #5
          Re: Invoicing totals

          Can you please give me an example for getting an invoice Subtotal, and where this would be set up using, tablesum() or dbsum() with the following parameters:
          Table is "Inv_hedr" variable is Subtotal
          Child table is Inv_detail
          Field in Inv_detail to be totaled is Extension
          Linking fields is Inv_ID (which is numeric).

          Comment


            #6
            Re: Invoicing totals

            Tablesum() is easier because it doesn't require an index tag name.

            Tablesum("Inv_detail","inv_id = "+inv_id,"Extension") would be the expression for a calculated field in Inv_Hedr to sum the values in the Extension field in matching records in inv_detail.

            Suppose you have an index on inv_detail with the expression inv_id and the tag name is id.

            Dbsum("inv_detail","id",inv_id,"Extension")
            There can be only one.

            Comment


              #7
              Re: Invoicing totals

              If the linking fields are numeric (N7) how is the expression written?

              Comment


                #8
                Re: Invoicing totals

                No difference how many places, the expression doesn't change if the field type is numeric.

                If inv_id were character the expression would be

                Tablesum("Inv_detail","inv_id = "+quote(inv_id),"Extension")

                You can experiment in the interactive.

                Choose a valid inv_id, do this in the interactive.

                inv_id = 12345 'use valid number
                ? Tablesum("Inv_detail","inv_id = "+inv_id,"Extension")

                You'll get a return like

                = 1247.36
                There can be only one.

                Comment


                  #9
                  Re: Invoicing totals

                  Not working in interactive or in field rules.

                  Comment


                    #10
                    Re: Invoicing totals

                    My apologies. Field name is extended not extension.

                    Comment


                      #11
                      Re: Invoicing totals

                      I just created a table my_inv_detail.

                      Structure

                      Code:
                      Inv_Id	Numeric	7	0	
                      Prod	Character	7	0	
                      Price	Numeric	7	2	
                      Qty	Numeric	4	0	
                      Extension	Numeric	9	2
                      Populated some records....

                      Code:
                      INV_ID	PROD	PRICE	QTY	EXTENSION
                      1	 	2.99	3	8.97
                      2	 	3.45	1	3.45
                      1	 	7.36	2	14.72
                      And in the interactive

                      Code:
                      inv_id = 1
                      
                      ? tablesum("my_inv_detail","inv_id = "+inv_id,"Extension")
                      = 23.690000
                      
                      ? dbsum("my_inv_detail","id",inv_id,"Extension")
                      = 23.690000
                      my_inv_detail.zip
                      Last edited by Stan Mathews; 01-25-2012, 03:43 PM.
                      There can be only one.

                      Comment


                        #12
                        Re: Invoicing totals

                        After making the above changes to how thew Subtotal is calculated (in field rules). The invoice no longer recalculates the subtotal when the invoice is modified. I tried refreshing the subtotal object with the onchange event of the browse but it didn't do anything.

                        Comment


                          #13
                          Re: Invoicing totals

                          The invoice no longer recalculates the subtotal when the invoice is modified.
                          Correct. That is the advantage of using a posting rule.

                          How else would the inv_hedr record know that the inv_detail linked records had changed? You could code the onsave event for the invoice form to recalculate the field rules for the inv_hedr table but that would process all records in the header table.
                          There can be only one.

                          Comment


                            #14
                            Re: Invoicing totals

                            Well, That's not good. Whats the point in using the tablesum or dbsum function in the field rules than? So other than posting, is the only other solution to use the total function on the Invoice form? And if I was going to print an invoice, I assume the field rules would not have an effect there either.

                            Comment


                              #15
                              Re: Invoicing totals

                              Just for kicks, try adding a button to the main form. (and try the object.refresh() method from there)
                              Also, without testing, I'm thinking parentform.Refresh_Layout() might take care of it??

                              I'm sure that you already know: If you simply drag a field (from the details table on the drag ad drop pane) down onto the main body of the invoice (outside the embedded browse, with the wizard enabled) a5 will create a working totals field. I suppose you could also write code to generate totals and place the code on some objects event that would occur after you exit the browse. ~ But why are you trying to accomplish this in other ways?

                              Also, resync, requery etc. could be related possible solutions, since you are trying to manipulate data at the parent level from within the embedded browse. I suspect this may have something to do with timing & indexes since you are relying on the table events to do the totaling. Actually, does the field rule calculation only happen only when the record is created (the first time?)

                              Honestly, I'm willing to bet that using field rules to calculate totals for the invoice is not an appropriate usage of table field rules anyways. (And at the very least, keeping totals on the form enables the form to do the work, so the database file is not constantly in use. ~ Even if you could get your method to work.)

                              From time to time, I have experienced unexpected results while using embedded browses. Possibly because the form's mode is set to auto???
                              (form properties ~ which is also the way most users have the a5 entry mode default set to. ~ insert / add / view are handled automatically)

                              As recently as last evening (working with v10.5) Strange things where happening on record level events that had been assigned in table field rule events.... (I wonder if this is somehow related.) ~ recently noticed that I couldn't trap (successfully write code for the on events) when the table was placed in an embedded browse.
                              Last edited by SNusa; 01-25-2012, 05:06 PM.
                              Robert T. ~ "I enjoy manipulating data... just not my data."
                              It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
                              RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

                              Comment

                              Working...
                              X