Alpha Video Training
Results 1 to 8 of 8

Thread: Running total function

  1. #1
    Dr Alok Modi MD
    Guest

    Default Running total function

    Hi Guys , another query:
    I know that running total function is designed for reports. i have been able to get it to function for forms as a calculated field. But can I make it work as a calculated field in the field rule in tables? I am not succeeding in the last three days.

    I have 4 tables:
    1. a_OPD
    2.b_OPD
    3.a_IPD
    4.b_IPD.

    1. Has fields which give charges collected from various hospitals on outpatient basis, for me.
    2. Has charges collected from various hospitals on outpatient basis for my wife
    3. same , but for indoor visits
    4. For my wife indoor visits.
    There are say 5 fields in each, each for each of the hospital. The topmostfield in each is the date field.
    The last field in each table is "Total collection for the day" which is easy because it is Hosp A+HospB+Hosp C+ HospD+ HospE.
    Now the 7th field I want in each table to be "Running total " for the month , so that it keeps adding the "Total collection for the day" daily, so at any given day, I can see the total sum so far.
    This is possible on a report , but reports don't have colors and stylesheets. Is there a way to give this "running total " function to the last field at the field rule level, so it can run as a layout form" WITHOUT XBASIC, as I am not conversan with XBasic?

    Sincerely,
    Dr Alok Modi MD

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Running total function

    Dr Modi,

    Unless you need to see the total collections each day DURING the day I wouldn't store the calculated sum in each record. In other words, if you're tracking the 'running total' for each day after the fact, I wouldn't store it in the data table in the first place. There MIGHT be a reason to store it there if the mid-day total was relevant to your practice.

    Ditto for the monthly totals. Unless the mid-month totals would impact how you practice I wouldn't store these figures in the table either.

    In my work I've found it best to avoid complex calculations until they're needed. This reduces the load on the cpu, the network, and speeds overall performance. Your approach would place this load on the system each time a new record is entered. I wouldn't do it.

    -- tom

  3. #3
    "Certified" Alphaholic
    Real Name
    Ohlen Cartmell
    Join Date
    Apr 2000
    Posts
    1,599

    Default RE: Running total function

    Our totals aren't as elaborate as yours; however, if we want to know a midday total, we just preview the day report. That will give us the total so far in the day.

    Like Tom says, if you try to do this on a form, you're creating a lot of overload on the program you really don't need. Regarding layouts, you can get pretty creative on a report regarding field layouts, etc.

    Ohlen

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: Running total function

    The documentation has - "not intended for table level field rules" - specific prohibition against table field rules, why would you "in the last three days" keep trying for three days?

    The run_total() for a record is fully dependent on the order in which the records are presented. How would a field rule be aware of that order?

    I have not tried it, but it should be possible to add a field to your table to hold the running total, then run an update operation to populate the field, based on some given record order. This operation could be run as often as desired.

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: Running total function

    Make the seventh field "month_ttl" and the total for day to be "day_ttl"

    The expression to use for the update operation is then

    day_ttl + previous("month_ttl")

    used to replace the value in the month_ttl field.

  6. #6
    Dr Alok Modi MD
    Guest

    Default RE: Running total function

    No This doesn't help me.

    can u give me a Xbasic command to achieve this. By the way why alpha five has not designed total and running total at table level itself?
    Dr Alok Modi MD

  7. #7
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: Running total function

    "No This doesn't help me." - - Why not, what is wrong with the suggestion.

    "can u give me a Xbasic command to achieve this." - - To achieve what? Do you mean the update operation or to compute the run_total()? - NO, there is no xbasic command to compute a run_total() outside of the bounds of where you can use run_total() itself.


    "By the way why alpha five has not designed total and running total at table level itself? " - The run_total() for a record is fully dependent on the order in which the records are presented. How would a field rule be aware of that order?

  8. #8
    "Certified" Alphaholic
    Real Name
    Ohlen Cartmell
    Join Date
    Apr 2000
    Posts
    1,599

    Default RE: Running total function

    Take a look at the tablesum function. You might be able to design a calculated field on the form with it that would do what you want. Tablesum will total a field in a table and can be filtered. If this would work, you could see the daily and monthly sum everytime you opened the form. Be aware that the calculation will take place everytime the form is opened and as the table grows in size, the filtered calculation will get slower as it deals with more and more records.

Similar Threads

  1. RUNNING TOTAL
    By Jeff Truax in forum Alpha Five Version 6
    Replies: 2
    Last Post: 06-08-2005, 10:25 AM
  2. Running Total
    By David Day in forum Alpha Five Version 5
    Replies: 3
    Last Post: 12-05-2002, 07:48 AM
  3. running total
    By gveneman in forum Alpha Five Version 4
    Replies: 2
    Last Post: 11-03-2001, 11:49 AM
  4. running total
    By Jerry Hartness in forum Alpha Five Version 4
    Replies: 2
    Last Post: 02-05-2001, 01:00 PM
  5. A running total
    By ron morrow in forum Alpha Five Version 4
    Replies: 1
    Last Post: 07-11-2000, 02:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •