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

Storing calculated fields in DB fields

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

    Storing calculated fields in DB fields

    I've created a set of three tables: a primary, a child, and a grandchild. I've created several calculated fields at the set level, which are the result of expressions involving data from the child and grandchild tables. I can successfuly use (see) these set-level calculated field values on a set form, etc., but I would like to store the calculated field data into a couple of parent table fields, and can't seem to find a way to do this.

    When trying to set up the expression for the calculated field rule, the set-level calculated fields that hold the data are not available to me in the expression builder. I've tried writing the expression manually, but it obviously is not seeing the set-level calc'd fields.

    Any thoughts? Thanks.

    #2
    RE: Storing calculated fields in DB fields

    Torrence,

    Try entering them manually again, using "Calc->" as a prefix. For example: Calc->TotalQty . This will usually do the trick.

    Comment


      #3
      RE: Storing calculated fields in DB fields

      Though my previous response works, why would you want to define the calc field at the set level, then store that calc field in the table.

      If you want to store a calculated value in the table, you can do all that in the field rules with one step.

      Or did I misunderstand what you are saying?

      Comment


        #4
        RE: Storing calculated fields in DB fields

        Vince, thanks for your thoughts. But....

        I'm using v3.04, BTW, and I find that when I use the Calc->(field) in the field rules, as you suggest, I get a couple of errors but can generally save the rule. However, when fetching through my form that has the Parent field, that field remains blank, as if the rule isn't working after all.

        What I'm trying to do involves some summary functions (TOTAL and MAXIMUM) that take values from a one-to-many child table, along with referenced values from the one-to-one grandchild table, munch the sums, and then I'd like to store that result in the parent table. The information is based on most-recent dates, and so on, and I need to keep the current value in the parent until, some or all of the one-to-many child records all contain equal dates, as the case requires, for example.

        Anyway, I wasn't able to build field rules for the parent table using direct references to the child and granchild tables. I guess it's true that the field rules (as stated in the user doc) are at the table level, not the set level. Yes, I've tried. So I figured that left me with only the option of using the calculated fields at the set level. Still I'm stumped on how to store a set-level calc'd field value into the parent table.

        I'm open to any more suggestions...

        Comment


          #5
          RE: Storing calculated fields in DB fields

          Some more info...

          I've constructed a test database to try and figure this out. Even with this vastly simplified db, I see the same type of behavior from the system.

          Here's my test structures:

          parent.tbl: p_id (linking field to one-to-many child table)
          value (the sum of all child.qty * gchild.price)
          child.tbl: p_id (linking field up to parent)
          g_id (linking field to one-to-one grandchild)
          qty
          gchild.tbl: g_id (link field up to child)
          price

          That's it! Now all I want to do is store the sum total of child.qty * gchild.price into parent.value! I wouldn't have thought that it would be so tough, but...

          For kicks I'm also attaching a self-extracting zip of this test db, if anyone is willing... ;)

          Comment


            #6
            RE: Storing calculated fields in DB fields

            If I understand you correctly, you enter the parent information and then the child information and want the child totals to be displayed in the parent? If so, the problem is the parent is saved before the children are entered Once the parent is saved, there is no event to trigger the calculation of the field rules. There's a couple of approaches you could try. The posting field rule could be used in the children to post the individual amounts to the parents. However, you can't reliably post a calculated field. Or you could create a script to calculate the totals and then post them to the parent. This is as reliable as the coding in your script. Another possibility is to create trigger the recalculation of the parent after the children have been entered. You can do this with a script that opens the table, then puts it in change mode and then saves the changes (but no changes are made, it just triggers the calculation of field rules). Hope this gives you some more ideas.

            Comment


              #7
              RE: Storing calculated fields in DB fields

              Okay, Vince and Ohlen, a small script seems to be the way to go. I've successfully stored the calc'd value into the parent field using a script triggered by fetching through the table. I'll have to make sure that I also trigger the script when I change some of the child and grandchild data that is summarized in the parent, but it'll work. Not elegant, but it'll work.

              Thanks for your responses!

              Comment

              Working...
              X