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: what happens here?

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

    Calculated field: what happens here?

    I have an embedded browse on a form based on a set.
    The set excists of a normal table as a parent and a table created by an operation as a child. Link one to one.

    In the emb browse you see the column GIP, which is a calculated field. Formula:
    IF (Child_table"FieldX"0,Child_table"FieldX,Parent_table"fieldY)
    Then I have a column Techn Voorraad which is a field from the parent table.
    Last field in the browse (Waarde) is a calculated field with the formula:
    Parent_table"Techn Voorraad*Child_table"Average_Child_table"FieldX

    All formulas in the browse work fine. All values in the image of the form are correct. But when I try to create a total field on the WAARDE column it does not give me the right result. As you see it should be 1910.00 but it ends up with 300.00

    What goes wrong ?
    I just took the last column of the browse and instead of VALUE chose TOTAL as usual. But...

    Regards,

    Marcel

    #2
    RE: Calculated field: what happens here?

    Is this a typing mistake or your actual code?

    IF (Child_table"FieldX"0, Child_table"FieldX, Parent_table"fieldY)

    It should be:

    IF (Child_table-"FieldX"0, Child_table-"FieldX, Parent_table-"fieldY)

    Comment


      #3
      RE: Calculated field: what happens here?

      Sorry Edward, typing mistake. I did not mention the actual names because they are confusing, but you are right I had to add the stripe. Typo.

      Marcel

      Comment


        #4
        RE: Calculated field: what happens here?

        Let me add to this:

        The column WAARDE in the browse has the following actual formula:

        CALC-"Waarde_calc

        The calculated field that produces the wrong value hads the following formula:

        total(calc-"Waarde_Calc)

        This must be right ?

        Greetings,

        Marcel

        Comment


          #5
          RE: Calculated field: what happens here?

          Marcel,

          Check the Functions reference on Total().

          It's a report writer function and is not supported when used elsewhere.

          -- tom

          Comment


            #6
            RE: Calculated field: what happens here?

            Hi Tom,

            That is strange, because the calculated field creates this code by itself if you set it for total instead of value.
            If it does not operate in forms/embedded browses, how would you else create a totalling function on a calculated field?

            Regards,

            Marcel

            Comment


              #7
              RE: Calculated field: what happens here?

              Marcel to echo Tom, from the CHM:
              "i"
              Note: This function is a report writer function, not intended for table level field rules or other expressions. While the function may perform in some areas outside of the report writer, its use there is not supported.
              "/i"
              I know what you mean. I have used it a lot on forms, etc. myself. Recently, my Acctg. Mgr. got a new machine, and the total function won't work on a certain form there, while it still works on others. c'est la vie!

              PG
              Peter
              AlphaBase Solutions, LLC

              [email protected]
              https://www.alphabasesolutions.com


              Comment


                #8
                RE: Calculated field: what happens here?

                Marcel to echo Tom, from the CHM:

                Note: This function is a report writer function, not intended for table level field rules or other expressions. While the function may perform in some areas outside of the report writer, its use there is not supported.

                I know what you mean. I have used it a lot on forms, etc. myself. Recently, my Acctg. Mgr. got a new machine, and the total function won't work on a certain form there, while it still works on others. c'est la vie!

                PG
                Peter
                AlphaBase Solutions, LLC

                [email protected]
                https://www.alphabasesolutions.com


                Comment


                  #9
                  RE: Calculated field: what happens here?

                  Peter, Tom,

                  So if I understood correctly, it might work in some cases, might not work in other cases, but the use is not supported anyway. Okay, let's add that to my bagage.

                  Any idea on how to do it in another way?

                  Greetings,

                  Marcel

                  Comment


                    #10
                    RE: Calculated field: what happens here?

                    Tablesum() and dbsum() would seem to be the choices to obtain totals.

                    Before you give up on total(), try substituting the background expression that derives the calc field.

                    Instead of

                    total(calc-"Waarde_Calc)

                    try

                    total(IF (Child_table-"FieldX"0, Child_table-"FieldX, Parent_table-"fieldY))
                    There can be only one.

                    Comment


                      #11
                      RE: Calculated field: what happens here?

                      Guys,

                      Another thing to it:

                      It is used in AlphaSports as well. In the form INVOICE you see an expression:
                      total(INVOICE_ITEMS-"Extension,GRP-"INVOICE_HEADER)
                      under the embedded browse in a totalling field.

                      This function looks rather important to simply state that it is not supported. In that case, the whole invoicing example of alphasports would not work, or, the functionality would not be supported.
                      Isn't that strange?

                      Greetings,

                      Marcel

                      Comment


                        #12
                        RE: Calculated field: what happens here?

                        I'll venture a theory (i.e speculation): It was supported for forms in a previous life, but something changed in v.5 to make that no longer be true.
                        Peter
                        AlphaBase Solutions, LLC

                        [email protected]
                        https://www.alphabasesolutions.com


                        Comment


                          #13
                          RE: Calculated field: what happens here?

                          Hi Peter,

                          Nice humor. By the way, your name sounds German or Swiss. Are you from one of those countries ?

                          If not by total(), how would one calculate the total of a column in an embedded browse ?
                          The hints in this thread seem to work for a table only.

                          Regards,

                          Marcel

                          Comment


                            #14
                            RE: Calculated field: what happens here?

                            Here is the way I did it on the form that teh total() stopped working on that I mentioned before. Attached toa button:

                            DIM tbl AS P
                            DIM tbl1 AS P
                            DIM tbl2 AS P
                            DIM vMsg AS C
                            DIM vTotal_Exp AS N
                            DIM vTotal_Fee AS N
                            DIM vTotal_Hours AS N
                            '========================FETCH CHILDs
                            tbl = table.current()
                            tbl1 = Table.get("Hours")
                            tbl2 = Table.get("Expenses")

                            tbl1.fetch_first()
                            while .not. tbl1.fetch_eof()
                            vTotal_Hours = vTotal_Hours + tbl1.Total_Hour
                            vTotal_Fee = vTotal_Fee + tbl1.Total_Fee
                            tbl1.fetch_next()
                            end while

                            tbl2.fetch_first()
                            while .not. tbl2.fetch_eof()
                            vTotal_Exp = vTotal_Exp + tbl2.Total_Cost
                            tbl2.fetch_next()
                            end while

                            tbl1.fetch_first()
                            tbl2.fetch_first()

                            vFee = str(vTotal_Fee,12,2,"$(")
                            vExp = str(vTotal_Exp,10,2,"$(")

                            vMsg = "Total Hours: " + vTotal_Hours + chr(13) + \
                            "Total Hourly Fee: " + vFee + chr(13) + \
                            "Total Expenses: " + vExp

                            ui_msg_box(trim(tbl.sort_by) + " Totals",vMsg,UI_INFORMATION_SYMBOL)

                            END

                            I could have written it to a form var, but the msg box was good for what it was being used for.

                            PG
                            Peter
                            AlphaBase Solutions, LLC

                            [email protected]
                            https://www.alphabasesolutions.com


                            Comment


                              #15
                              RE: Calculated field: what happens here?

                              Thanks Peter for sharing that. I will study it and see how it fits in. Thanks again.

                              Marcel

                              Comment

                              Working...
                              X