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

    #46
    Re: Invoicing totals

    Thought everyone might like to know.... The bug (calculated fields in embedded browses) I reported here in post #40 above has been confirmed.

    I had reported it last year, but never included an example. ~Hence, I suspect Alpha thought it was originally attributed to user error.

    Next service release will be fixing this. (It is a bug which caused calculated field totals (and all sorts of other things) to not work properly on embedded browses once they are placed inside a form.)

    I was able to reproduce the bug you reported.
    The child browse calculated fields existed, but did not evaluate correctly in the context of the set because they used short names. Logic has been added to fixup the browse fields on load so that they use the child alias table .
    This will be available in the next V11 patch.

    Thanks,
    Cian
    Last edited by SNusa; 01-27-2012, 04:40 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


      #47
      Re: Invoicing totals

      So I have completely redone, how my invoice calculates its totals and balances. I previously used a combination of stored calculation fields, and posting. Now I'm using a series of dbsum calculations that have been set up in the Invoice header. Im still trying to accomplish one thing that is not working. A calculated field named c_balance keeps track of the balance due on an invoice. But I want to also store that value in a regular (stored) field named balance.

      So I have this code entered in the cansave event of the invoice form.

      tbl = table.current()
      tbl.balance = C_balance.value

      It doesn't do anything.

      Comment


        #48
        Re: Invoicing totals

        Barry, I think it's a mistake to mix code as you are doing in post 47.

        First point:

        Xbasic permits your scripts to talk directlly to the table supporting your form. You do this with "tbl.balance", for example.

        Xbasic permits your scripts to talk to the table supporting your form INdirectly through objects in the forum layout itself. You do this with "C_balance.value"

        I think it's a mistake to mix methods in the same script. Use code that talks directly to the table throughout, or use code that talks indirectly throughout.


        Second point:

        "C_balance.value" may need to be referenced as: Calc->C_balance
        The object displaying "C_balance" could be referenced as ":formname:object_name.value"


        Third point.

        When your script talks directly to the table you should verify the table is in change or enter mode before trying to assign values to table fields.


        Last point.

        This sounds like a new issue. Should be posted in a new thread.

        Comment


          #49
          Re: Invoicing totals

          Tom,
          I got it to work by changing the code to:

          tbl = table.current()
          tbl.balance = calc->C_balance

          However as you stated above, the updating of the balance field only works when the Inv_hedr table is in change, or enter mode. If the balance is changed because I have added or modified a inv_detail record the cansave event in the Inv_hedr doesn't execute. How would that be fixed?

          Comment


            #50
            Re: Invoicing totals

            Originally posted by barry685 View Post
            So I have completely redone, how my invoice calculates its totals and balances. I previously used a combination of stored calculation fields, and posting. Now I'm using a series of dbsum calculations that have been set up in the Invoice header. Im still trying to accomplish one thing that is not working. A calculated field named c_balance keeps track of the balance due on an invoice. But I want to also store that value in a regular (stored) field named balance.

            So I have this code entered in the cansave event of the invoice form.

            tbl = table.current()
            tbl.balance = C_balance.value

            It doesn't do anything.
            Exactly the same point made about trying the code in the interactive. The code you posted doesn't work because you haven't used the proper steps.

            For the interactive I suggested

            Code:
            tbl = table.open("Inv_hedr")
            tbl.change_begin()
            tbl.subtotal = C_subtotal.value 
            tbl.change_end(.T.)
            tbl.close()
            Since you are now operating in the context of the form you can use table.current() and dispense with closing the table.

            Code:
            tbl = table.current()
            [B][COLOR="#FF0000"]tbl.change_begin()[/COLOR][/B]
            tbl.subtotal = C_subtotal.value
            [B][COLOR="#FF0000"][/COLOR][COLOR="#FF0000"]tbl.change_end(.T.)[/COLOR][/B]
            There can be only one.

            Comment


              #51
              Re: Invoicing totals

              This code works
              Code:
              tbl = table.current()
              tbl.balance = C_balance.value
              tbl.Total = C_Total.value
              When then Invoice header is in change or enter mode. It doesn't work in view mode, even if the value of the invoice changes due to changing an an invoice detail record. So how do you modify the code to handle that?

              Comment


                #52
                Re: Invoicing totals

                parentform.commit()
                tbl = table.current()
                tbl.change_begin()
                tbl.subtotal = C_subtotal.value
                tbl.change_end(.T.)
                There can be only one.

                Comment


                  #53
                  Re: Invoicing totals

                  I have written this code. I am not getting any error messages but it still dosen't work if the parent form is not modified.
                  Code:
                  dim tbl as p
                  tbl = table.current()
                  
                  IF tbl.mode_get()=0 then  'view mode
                  	
                  	tbl.change_begin()
                  		tbl.balance = C_balance.value
                  		tbl.Total = C_Total.value
                  	tbl.change_end(.T.) 
                  	
                  	else
                  		tbl.balance = C_balance.value
                  		tbl.Total = C_Total.value
                  End if

                  Comment


                    #54
                    Re: Invoicing totals

                    Originally posted by barry685 View Post
                    I have written this code. I am not getting any error messages but it still dosen't work if the parent form is not modified.
                    Code:
                    dim tbl as p
                    tbl = table.current()
                    
                    IF tbl.mode_get()=0 then  'view mode
                    	
                    	tbl.change_begin()
                    		tbl.balance = C_balance.value
                    		tbl.Total = C_Total.value
                    	tbl.change_end(.T.) 
                    	
                    	else
                    		tbl.balance = C_balance.value
                    		tbl.Total = C_Total.value
                    End if
                    Just curious everyone: If you add tbl.change_begin() & tbl.change_end() to the else clause, does this create an error, since the table is already in change mode?

                    I haven't been following this thread too closesly. But since this is in a browse, are you sure it's not related to the form / embedded browse bug when using calculated fields @ post #46?.... (to be fixed in next v11 update?)

                    When defining a calculated field:
                    vcx_CalcField=fieldname (works in browse tab but won't work when browse is embedded in form)
                    vcx_CalcField=childtablename->fieldname works (works in browse tab and works when browse is embedded in form)

                    ~Expression builder does not /will not/ can not build the calculated field like this. You have to add "childtablename->" manually, after creating the expression.


                    Also: Just for kicks, try substituting =C_balance.text for =C_balance.value.... (It's solved a few problems for me when action scripts don't work, and are converted to X-basic and debugged using watch variables. ~ (working with record data "values" within embedded browses)
                    Last edited by SNusa; 01-29-2012, 08:52 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


                      #55
                      Re: Invoicing totals

                      Yes

                      Comment


                        #56
                        Re: Invoicing totals

                        Barry,

                        I see that you're choosing not to follow my earlier recommendation. Have you been talking to my wife?

                        Suggest you verify whether the table is actually being updated or not by examining the table with the default form or browse. When your script writes values DIRECTLY to the underlying table the form will not auto refresh so you can't tell if the assignment of values has occurred by looking at the form. In these cases you would include code in your script to refresh or resynch the display. Your form is waiting for input from mouse or keyboard. It is not "aware" that your script is writing to the underlying table.

                        Comment


                          #57
                          Re: Invoicing totals

                          Tom,
                          I am getting slightly different answers from you and Stan. Other than not taking your advise on starting a new thread, I have partially taken your advice and tested for the mode. I have also tried changing the C_balance.value
                          to Calc->C_balance, and it didn't make a difference. The only issue I am having, is I need a way to force the calculated fields to update the stored fields when the parent form has not been physically edited. If I do edit the header the update works, whether I use the .value expression or the Calc-> expression.

                          Comment


                            #58
                            Re: Invoicing totals

                            Barry
                            If I understand your last question. Whatever the cause of change is.
                            If you are viewing a form and changes are made elsewhere to the underlying tables - like by another user perhaps, the form will not know when change occurred.
                            Not unless you program for this.
                            If it is necessary for your user to get this update continuously whilst viewing the form then maybe you must trigger a refresh
                            Or you might opt to lock the records concerned.
                            By example if you were viewing an excel spreadsheet and MS allowed other users to open the same "table", your view would not magically change to see the other users changes. They don't allow changes to be made*. Alpha does, and if you want it to then you must be aware of the possibilities and responsibilities of your design.

                            *if you use a linked data table in Excel you can set a refresh rate.
                            You can use the same thing in Alpha forms - its called "on timer"

                            If you have script triggered from the form then you can force the refresh from that script.
                            And you don't have to listen to Tom - his wife doesn't - I think they're all in collusion.
                            Last edited by Ray in Capetown; 01-30-2012, 06:04 PM.

                            Comment


                              #59
                              Re: Invoicing totals

                              Hi Ray,
                              Not sure if you understand the question. I'm not concerned with refreshing the display. It's not a multi user issue. invoice.png
                              On the bottom of the invoice there are 2 fields that are regular, stored fields in the inv_hedr table. They are not calculated fields. The fields Total and Balance below the right side of the invoice are calculated fields, that get their values thru the dbsum function.
                              The problem I am having is, if I do not edit the invoice header, and make a change to the items, the calculated fields update properly, but they don't update the stored fields, when I exit the form. However If I do edit the invoice header the stored fields are updated properly. I have placed the code into the cansave event. Perhaps the cansave event does not fire if the header is not edited.

                              Comment


                                #60
                                Re: Invoicing totals

                                Barry, your guess is right. the CanSave event in the form won't fire until the user changes the record and begins the process of saving it. Did you know you can see a list of events using the trace window? Can be a useful design and debugging tool. Suggest you get acquainted with it after the dust from this thread settles.

                                -- tom

                                Comment

                                Working...
                                X