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

Calculated field displayed

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

    Calculated field displayed

    Have a calculated field on a form with the following:
    Code:
    vcOrderTotals = calc->Vctotals + Req_Amt_Tot
    The vcTotals is totaling a field in an embedded browse. All is working just fine except when I am entering a new record. Cannot get the vcOrderTotals field, which I have displayed on the form as a ReadOnly, to reflect it's value. (I have this code in the OnArrive event of the first field.) In my debugging exercise, first two attachments, another question comes up. I am assuming that calc->vcOrderTotals is the calc field itself, and the parentform.vcOrderTotals is what is displayed on the form. What I don't understand is why the field itself shows zero, while the displayed value shows properly here, but not on the form? (I don't have the calculation in the code itself. Just put it there to see if I could get it to display.)
    The only way I have found to get it to display the value of the calc field it to issue a field.refresh() in the OnDepart event of the first field. However, what is displayed is shown in the 3rd attachment. If I don't issue the refresh(), zero is displayed (4th attachment). It does get calculated when I save the form.
    Would like to figure out what I'm doing wrong here. Any help greatly appreciated.
    Thanks.
    Ernie

    #2
    Re: Calculated field displayed

    Cannot get the vcOrderTotals field, which I have displayed on the form as a ReadOnly
    Unnecessary. A calculated field is, by definition, read only.

    If vcOrderTotals is a calculated field then any script lines referring to the form object or the underlying calculated field, where a value assignment is concerned, are pointless.

    A form level calculated field should show a new value when you alter the value of one of the form object values involved in the calculation and depart the field.
    There can be only one.

    Comment


      #3
      Re: Calculated field displayed

      Stan,
      That makes sense. There is no ReadOnly property for a Calc field. I guess what I meant to say was "Disable" so it can't look like it can be changed by selecting it. The "Req_amt_total" field is a Field Rules calculated field. It calculates fine. I know that the calculated field will update itself if one of the parts in the calculation change, which it does. However, most of the time, on entering a new record, none of the parts will change. That was why I am trying to figure out a way to manually make it re-calculate. Maybe there isn't a way.

      Hope the following makes sense. One of the parts to the field rules calculated field has a field rules default value of 1. On entry into the form, I am doing a lookup into another table to get a value to set the other part to that calculation. Once this happens, I would like to force my calculated field to re-calculate. Is there any way?
      Appreciate your help, as always.
      Ernie

      Comment


        #4
        Re: Calculated field displayed

        One of the parts to the field rules calculated field has a field rules default value of 1.
        That's a table level field rule setting and you said you were defining a form level calculated field.

        How have you set up the default creation?

        When Default Values Are Created

        Normally a default value is created when the cursor enters the field for which the Default rule is defined. You can control when the default value is created.

        Check Set default value at start of data entry to have Alpha Five apply default value(s) when the new record is created.

        Check At end of enter, set default value if field not touched by user to have Alpha Five apply default value(s) when the record is saved.
        Sounds like you chose the second option.
        There can be only one.

        Comment


          #5
          Re: Calculated field displayed

          Stan,
          It's set up for "start of data entry".
          Ernie

          Comment


            #6
            Re: Calculated field displayed

            Originally posted by enstorms View Post
            Stan,
            It's set up for "start of data entry".
            Ernie
            In other words, it's a table level calculated field and these won't update until the whole record is saved. If you can create a form level calculated field (not just a copy of the table level field but a separate 'calc field' created in the form itself), this will update as you change each field on the form. (OK, it doesn't update until you actually leave the field but that shouldn't be any big deal. Besides, what would be the point to updating as you typed in each new digit of a number like 423.14?)

            Your initial comment created confusion: "Have a calculated field on a form with the following:" Yes, your field is now shown on the form but it apparently wasn't created on the form and that makes a big difference in how they work. This difference is one of those things that isn't intuitively obvious but is very useful to know.

            FWIW: In most cases where I need a calculated field, I just create it on the form or report that I need it on. Occasionally it's handy to have that field in the table also for sorting or searching but notice that I didn't say "I need it in the table" because you can almost always just do the calculation on the fly. There are probably some situations where it isn't feasible to do the calculation on the fly but it usually is. I try to avoid doing it both in the table and on the forms so that I don't end up with different calculations after a series of edits/updates.

            Comment


              #7
              Re: Calculated field displayed

              Cal,
              Sorry about all the confusion. Still getting used to how to refer to things like calculated fields. Here's the "real" scoop.
              The calculated field I'm dealing with IS a "form level calculated field" (vcOrderTotal) This field calculates a total based upon:
              vcTotals (another "form level calculated field") that is totaling a field in an embedded browse. It takes this total and adds it to the value of a table field ("Req_amt_tot") which is a "Table level calculated field".
              "Req_amt_tot" takes a count field in the table and multiplies it by another numeric field in the table.
              Have got a zip file but it's a little over the limit. A couple of DDM files are 2.5 to 4.5mb. I've got to figure out what's going on here with them. Haven't taken time to look into that. Ok, reduced a set and got it under 5mb. Open form "order_form" then press the button "New order for selected..." It opens the "order_details_form". The order_header table has the calculated field (req_amt_tot). Hope you can make sense of all this.
              Appreciate the help.
              Ernie
              P.S. The code I'm using is on the first field (Cust_Id) of the order_details form.

              Comment


                #8
                Re: Calculated field displayed

                Hi Ernie,

                A bit late into this and most of the work has already been done getting to know exactly what it is you want and where to find it and such...but one way to "force" the value to be recalculated is to change a field and then change it back ... such as your Req_order_cnt field----you can use Action Scripting if you want


                On the Save and close button of the detail_order form---
                Set Properties of Objects / choose first to see the properties of the Order_details form and then choose the Req_order_cnt field value and specify expression and put the explicit form name as it is not in focus (see screenshot) and add 1 to it. Save record for the order_details form (have to choose "select other form to do this). Then right away do the same two steps but subtract 1.

                Yeah I know, a work-a-round but I have seen other such convoluted methods before to force what is wanted when no other way is forthcoming--am hoping someone in this thread comes up with a better way truthfully.

                Last edited by MikeC; 06-27-2008, 11:15 PM. Reason: typo
                Mike
                __________________________________________
                It is only when we forget all our learning that we begin to know.
                It's not what you look at that matters, it's what you see.
                Henry David Thoreau
                __________________________________________



                Comment


                  #9
                  Re: Calculated field displayed

                  Hi Mike,
                  Thanks for the help. If you've looked at the zip I sent, take a look at the order_details form. Look at the events for the first field, Cust_Id. In the OnDepart event, (I had it commented out in the zip file) I have this:

                  topparent:Vcordertotals.refresh()

                  This does in fact force the calculation, but produces a "garbled" look to the number as in, I think, the third image of my original post. This is better than just showing zero, so will accept it for now. Would be nice to know why it shows up that way, or a better way of getting it to re-calculate.
                  Thanks again.
                  Ernie

                  Later: Found the problem with the "garbled" field display to be a "repaint()" issue. So after the above code, I issue:
                  topparent:Vcordertotals.repaint()
                  This clears it up.
                  Last edited by enstorms; 06-28-2008, 09:21 AM.

                  Comment

                  Working...
                  X