Dawn, you described two processes in your response. The first by defining a variable with the calculation and then placing it on the form. I tried that method but I could not get it to update properly. I also tried using an EEP to do the calculation on entry to the field. Neither process worked consistently.
Your second process of using an EEP on row change is the one that works for me. I have no idea why I could not get the 1st method to work. John -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dawn Oakes Sent: Thursday, August 19, 2004 5:25 PM To: RBG7-L Mailing List Subject: [RBG7-L] - Re: Variables recalc in forms John OK - I'm confused. Here's what I did in a form of mine to see if I could get what you're looking for: Form is Customer based on table Custlist. In another table called BillHistory, there is an amount column which holds invoice totals. To display the total of all invoices for each customer: 1. I define a variable in the variables menu of the form called vCustTotal. It is defined as (sum(amount)) from BillHistory where custno=custno. For the table name, I choose Custlist. 2. I then place a variable edit for vCustTotal on my form. When I do edit using Customer and scroll through the customers, the variable field shows the total for each customer. (This takes a really long time to scroll between customers because there is many years of data for it to total -- but it works.) I also did it this way: Same as above, except: Under Tables, for the Custlist table I created on On Row Entry EEP SET VAR vamount CURRENCY = 0.00 SELECT (SUM(amount)) INTO vcusttotal FROM billhistory WHERE custno=.vcustno AND invdate > 07/01/04 RECALC VARIABLES RETURN In the variable section, I have a variable vcustno, defined as custno. I also redefine the vCustTotal taking out the expression and replacing it with .vCustTotal. This also displays the proper totals when scrolling through the customers (seems to work faster too.) I'm not sure if there is a preferred way of doing this, or one which makes it go faster. But since your code is working properly...well is evaluating the variable properly, go through one of the scenarios above to see if you can get it to work. Dawn -----Original Message----- From: John Engwer [mailto:[EMAIL PROTECTED] Sent: Thursday, August 19, 2004 4:39 PM To: RBG7-L Mailing List Subject: [RBG7-L] - Re: Variables recalc in forms Javier and David, thanks for your help. I have the property syntax correct, I just typed it wrong in the Email (PROPERTY FORM puredit1 'REFRESH'). Here is some more information; maybe you can help me find what is wrong. If I do an edit using puredit1 where the last name = Jones I get a lot of records as expected. As I step through the names to find John Jones the var vAMT_OWED does not update as I move from record to record. Maybe it shouldn't because the EEP triggers on entry to the name field. Once I find John Jones, if I click on the address field and then click again on the name field the var updates. If I use a where clause and go directly to John Jones the var displays properly. Is there a way to fire the EEP every time I move to a new record in my puredit1 form? John -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Javier Valencia Sent: Thursday, August 19, 2004 3:08 PM To: RBG7-L Mailing List Subject: [RBG7-L] - Re: Variables recalc in forms >> Try: >> >> Property TABLE puredit1 'REFRESH' It should be: PROPERTY FORM puredit1 'REFRESH' If you want to refresh the form, or: PROPERTY TABLE your_table_name 'REFRESH' If you want to refresh the table. Javier, Javier Valencia, PE President Valencia Technology Group, L.L.C. 14315 S. Twilight Ln, Suite #14 Olathe, Kansas 66062-4578 Office (913)829-0888 Fax (913)649-2904 Cell (913)915-3137 ================================================ Attention: The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all system and destroy all copies. ====================================================== -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of David M. Blocker Sent: Thursday, August 19, 2004 1:58 PM To: RBG7-L Mailing List Subject: [RBG7-L] - Re: Variables recalc in forms John Your PROPERTY command is refreshing the TABLE but it has in in the name of the FORM!!! Try: Property TABLE puredit1 'REFRESH' Also, the COMPUTE command should be used ONLY when SELECT won't do the job, as in COMPUTE varname AS ROWS FROM table COMPUTE varname AS STD (columnname) FROM table COMPUTE varname AS VARIANCE (columnname) FROM table Instead use: SELECT SUM (amt_owed) INTO vamt_owed INDICATOR vI1 from invoice WHERE cust# = .vcu_no David Blocker [EMAIL PROTECTED] 781-784-1919 Fax: 781-784-1860 Cell: 339-206-0261 ----- Original Message ----- From: "John Engwer" <[EMAIL PROTECTED]> To: "RBG7-L Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, August 19, 2004 2:14 PM Subject: [RBG7-L] - Variables recalc in forms > I am still having great difficulty getting my variables to update > properly in forms. Here is what I am doing: > > I have a form with a main table is called customer that is used to > edit customer information and display the customers purchase history > in a DBGrid > from the purchase table. > The form name is puredit1 > Form is set as one - many > I have a variable called vAMT_OWED that I want to display the amount > that the customer owes. > I am using the following EEP to perform the calculation > > SET VAR vamt_owed = 0 > COMPUTE vamt_owed AS SUM amt_owed from invoice WHERE cust# = .vcu_no > Property TABLE puredit1 'REFRESH' > recalc variables > RETURN > > I have traced the EEP and it calculates the correct amount and puts it into > the var vAMT_OWED > > I currently have the EEP triggering on entry to the customer name > field in the customer table. I have tried it "on entry to" of various > fields on the > form. > Sometime when I click on the .vAMT_OWED field, the field will update > properly. > > Does anyone have an idea as to what I may be doing wrong? > > John > >
