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

expression to create a database field

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

  • #16
    Re: expression to create a database field

    ATTN: STAN MATHEWS... FROM: JOHN LINLEY
    A question re: TABLESUM() FUNCTION!

    IN A PARTICULAR SET, ON ENTERING NEW DATA, THE PARENT FIELD SUMMARIZING THE CHILD NUMERICAL DATA DOES NOT CHANGE AS NEW DATA IS ENTERED. HOWEVER, IF I GO TO THE CHILD TABLE AND RE-EVALUATE FIELD RULES AND THEN RETURN TO THE SET; THE SUMMARIZED PARENT DATA WILL NOW REFLECT THE NEW ENTRIES. IN ALPHA4, ALL PARENT SUMMARY FIELDS REFLECT NEW ENTRIES AS ENTERED. IS THERE A CURE FOR THIS ?? I AM ASSUMING I HAVE MISSED SOMETHING IN THE EXECUTION OF THE TABLESUM() FUNCTION.

    REGARDS, JOHN LINLEY

    Comment


    • #17
      Re: expression to create a database field

      John, it seems that you have created a calculated expression field rule for a field in your parent table. The expression uses tablesum() to generate a total from the linked records in the child table. The calc field expression will be re-evaluated each time you save a change to the parent table record, not each time you save a change (or enter new records) to the child table. Unlike Alpha Four, Alpha Five does not have field rules for the "set" per se. All field rules are saved to the table. A set cannot have field rules.

      I'm familiar with two different ways to keep an "automatic" running total in a parent record, where the total sums all the linked child table records.

      1) after establishing the initial summary total using a saved update operation, you can use a post field rule in the child table to add transaction table (child table) field values to the summary total field as each transaction record is changed or entered.

      2) you can use events in the data entry form layout to run a new total and assign the new total to the suummary total field.

      In many applications keeping a running total in the parent table is unnecessary. The total can be computed when needed. The total can be displayed on screen in the form layout or included in a report without having the computed value actually stored in the parent table.

      As a newcomer to the message board permit me a personal observation. The use of ALL CAP LETTERS is usually reserved to signal a loud voice or shouting. For most all cap text is a bit harder to read. There are exceptions (the visually handicapped come to mind), but I thought I'd mention this in case you weren't aware of it.

      Comment


      • #18
        Re: expression to create a database field

        to: Tom Cone Jr ... from john linley:

        I much appreciate your quick response. I like both of your suggestions for a tablesum()
        replacement. I think I will try an "event action" on some forms and a posting field rule from child to parent on others. It is just a habit of mind to use all caps, but I will curb this habit in the future.

        Thanks again.

        Comment


        • #19
          Re: expression to create a database field

          To Stan Mathews

          Sorry to bring this up again, but, if I may..

          I wrote the following calc field rule in a set acc/receivable. I am attempting to summarize a child field "ord_tot" N-8-2 (for all records per customer) to a field in the parent table "YTd SALES" N-9-2.

          tablesum( "sales_bl" , "cust_id= " +quote(cl_cust_id) , "ord_tot" )

          cust_id is the linking index between parent and child and also a child index name.
          cl_cust_id is a parent index name.

          Switching indexes in the expression also did not work. Would much appreciate your help.

          john linley

          Comment


          • #20
            Re: expression to create a database field

            Indexes have nothing to do with a tablesum expression.


            tablesum( "sales_bl" , "childfieldname = " +quote(parentfieldname) , "ord_tot" )


            where childfieldname is the name of the customer id field in the child table and parentfieldname is the name of the customer id field in the parent table. This would be the expression to sum the ord_tot field in the sales_bl table for records where the value in the customer id field in the child table match the value in the customer id field in the current record in the parent table.
            There can be only one.

            Comment


            • #21
              Re: expression to create a database field

              Good evening Stan;

              When I read your version of the expression with accompanied, most clear, explanation. I thought, at long last I am beginning to understand this (tablesum) thing.

              So, I went to the set, "acc Receivable" which links the two tables "customer list" and "sales_bl" and I entered at the field name, "YTD SALES" in the "customer list" table
              the following calculated field rule expression:

              tablesum("sales_bl","cust_id = " +quote(Cust_id),"ord_tot")

              The "Cust_id" field is identical in name, type and length (char-7) in both tables and is the linking field in the set.

              However, it didn"t work. The error message was "not a valid expression".

              A posting field rule also requires matching fields, so this makes the utmost sense.
              Could I be placing this calculated field expression in the wrong place?

              Going nuts again, John

              Comment


              • #22
                Re: expression to create a database field

                Well, I'm confused here. You mention a posting field rule and a calculated field. These are mutually exclusive. You cannot post to a calculated field.

                I am attaching a small sample database in which the ord_tot field in the sales_bl table is posted to the ytd_sales field in the customer list table. This has nothing to do with a tablesum() expression. The amount in the ord_tot field for each record is added to the ytd_sales field in the customer list table. This is what posting is design to do.

                If you define the ytd_sales field to be calculated with the tablesum() expression`you have to force the recalculation of the field so that the amounts in any new records to show up in the ytd_sales. A calculation such as this is really more appropriate to a form or report calculated field where you want to show the latest total.

                This begets the question, why do you want to store the ytd_sales total when you can easily calculate it at any time?
                There can be only one.

                Comment


                • #23
                  Re: expression to create a database field

                  Stan:

                  Last night, I thought I sent another message. The content of the message was,
                  After reading your explanation of the tablesum function, I tried it elsewhere, and it worked correctly the first time I wrote the expression. I do believe, that now, I can use this function as and when needed without any further bother.
                  I also added that your patience is admirable, your assistance is invaluable, and I am much much appreciative. You and others have been most helpful.

                  I wonder where that othr reply went? I must have attached it in the wrong place.

                  Well, thanks again, John

                  Comment


                  • #24
                    Re: expression to create a database field

                    I wonder where that othr reply went?
                    Lost in cyberspace, I suppose. Glad you got to where you needed to be.
                    There can be only one.

                    Comment

                    Working...
                    X