Alpha Video Training
Results 1 to 18 of 18

Thread: Totals for an individual

  1. #1
    Member
    Real Name
    marcello cosenza
    Join Date
    Dec 2005
    Posts
    54

    Default Totals for an individual

    Hi there,

    Im a complete novice at databases but have managed to put together an application that allows me to record information im told by my sales people. However, I am having difficulty putting together a calculation which totals up the figures for an individual user. All I have so far is a calculation which adds up all the values in the database. The calculation for that is as follows = total(activeprice ->price).

    From left to right the fields I have in my database are as follows. Contactid, Name, Date, Salesnotes, Price. I have had a look through the help section but it may as well be written in another language. Any ideas would be gratefully welcomed. Thanks.

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

    Default

    Quote Originally Posted by cello78
    Hi there,

    Im a complete novice at databases but have managed to put together an application that allows me to record information im told by my sales people. However, I am having difficulty putting together a calculation which totals up the figures for an individual user. All I have so far is a calculation which adds up all the values in the database. The calculation for that is as follows = total(activeprice ->price).

    From left to right the fields I have in my database are as follows. Contactid, Name, Date, Salesnotes, Price. I have had a look through the help section but it may as well be written in another language. Any ideas would be gratefully welcomed. Thanks.
    Where do you want to see the calculation's results? Form, report, browse?

    Total() is a report writer function which would give you results for individual sales people if you create a report grouping on sales person.

  3. #3
    Member
    Real Name
    marcello cosenza
    Join Date
    Dec 2005
    Posts
    54

    Default

    That's what I figured. I need to see the results in a field box at the bottom of the page so it would more than likely be a form or possibly a browse. I was lead to believe that tablesum() would be more appropriate.

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

    Default

    Quote Originally Posted by cello78
    That's what I figured. I need to see the results in a field box at the bottom of the page so it would more than likely be a form or possibly a browse. I was lead to believe that tablesum() would be more appropriate.
    A browse doesn't have a "bottom of page" so I think a form is your best bet.

    I've attached a small sample of how it can be done on a form using tablesum().
    Last edited by Stan Mathews; 03-28-2006 at 03:24 PM.

  5. #5
    Member
    Real Name
    marcello cosenza
    Join Date
    Dec 2005
    Posts
    54

    Default

    Thanks very much for the example. I shall have a look at it now.

  6. #6
    Member
    Real Name
    marcello cosenza
    Join Date
    Dec 2005
    Posts
    54

    Default

    Below is the formula you put in the test example. I have adjusted it to fit in with my criteria whereby activesterling is the name of the database, contactid refers to the users and profitloss is the column that needs totalling up. I keep getting a invalid or incomplete expression. Any ideas on what i've done wrong?


    total = tablesum("activesterling","Contactid="+quote(contactid),"Profitloss")

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

    Default

    Quote Originally Posted by cello78
    Below is the formula you put in the test example. I have adjusted it to fit in with my criteria whereby activesterling is the name of the database, contactid refers to the users and profitloss is the column that needs totalling up. I keep getting a invalid or incomplete expression. Any ideas on what i've done wrong?


    total = tablesum("activesterling","Contactid="+quote(contactid),"Profitloss")
    That should be correct if "contactid" is a character field and "profitloss" is a numeric field.

    If "contactid" is numeric then

    total = tablesum("activesterling","Contactid="+contactid,"Profitloss")

    is the correct syntax.

    If these don't solve the problem, attach a small sample.

  8. #8
    Member
    Real Name
    marcello cosenza
    Join Date
    Dec 2005
    Posts
    54

    Default

    I see where i've gone wrong now Contactid is numeric. Your suggestion looks to have fixed the problem. Many thanks.

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

    Default

    Quote Originally Posted by cello78
    I see where i've gone wrong now Contactid is numeric. Your suggestion looks to have fixed the problem. Many thanks.
    A generally accepted database procedure is to make a field numeric only if its contents will be used in a computation. Character strings lend themselves to much easier manipulation.

    Not a rule, just a thought.

  10. #10
    Member
    Real Name
    marcello cosenza
    Join Date
    Dec 2005
    Posts
    54

    Default

    And one I won't forget in a hurry. Thank you very much for your help.

  11. #11
    Member
    Real Name
    marcello cosenza
    Join Date
    Dec 2005
    Posts
    54

    Default

    I have one more question which you might be able to help on. I see that when I amend a price the calculation updates the table but not the field the total is displayed in. Is there a simple refresh I can apply or do I have to write up a function that will update everything accordingly?

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

    Default

    Quote Originally Posted by cello78
    I have one more question which you might be able to help on. I see that when I amend a price the calculation updates the table but not the field the total is displayed in. Is there a simple refresh I can apply or do I have to write up a function that will update everything accordingly?
    The calculated field should display the correct value when the new record is saved. Until then the price is not available to the tablesum() function. Test this by moving up or down record and then back.

  13. #13
    Member
    Real Name
    David Nunn
    Join Date
    Nov 2005
    Posts
    88

    Default

    I was interested to read this, because i have a similar problem with a database for some simple research.

    I need to see a master table of products with the total number of marks each one receives in a database of survey responses. I want this to be a value stored in a browse because I need to export the table to excel so it can be typeset.

    What would be a good function to use in situation like this?

    Kind regards

    David
    Last edited by cellboy; 12-23-2005 at 09:15 PM.

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

    Default

    Quote Originally Posted by cellboy
    I was interested to read this, because i have a similar problem with a database for some simple research.

    I need to see a master table of products with the total number of marks each one receives in a database of survey responses. I want this to be a value stored in a browse because I need to export the table to excel so it can be typeset.

    What would be a good function to use in situation like this?

    Kind regards

    David
    You'll have to provide us with some information which may be perfectly clear to you but...

    I need to see a master table of products with the total number of marks each one receives in a database of survey responses. I want this to be a value stored in a browse because I need to export the table to excel so it can be typeset.

    Well
    I need to see
    What does this mean? You want to display, store information about?

    and
    with the total number of marks
    What is a mark?

    I want this to be a value stored in a browse
    Nothing is stored in a browse, a browse is a means of viewing a table's fields or computations involving those fields.

    Please post again and explain what you mean.

  15. #15
    Member
    Real Name
    David Nunn
    Join Date
    Nov 2005
    Posts
    88

    Default

    Whoops! It was rather late by the time I posted this, that's my excuse. Let's try again:

    I have an index of products, and a data base of survey responses where they have received ratings from respondents. They are joined on the product name in a one to many link.

    I want to be able to add up all the scores an individual product has received, then sort the products by total score into a top twenty. Finally I need to be able to export this top twenty into an excel spreadsheet.

    We are just moving across from Filemaker to Alpha because it's easier to work with, and are rebuilding some applications now run on the former. In Filemaker it was easy to deal with totals. In this example, a calc field would be added to the mastertable total that would add up the scores for the matching product in the child table. I'm afraid I've been struggling to grasp how to achieve something similar with Alpha. :o

    Not got very far with help files, etc. Any pointers or reference material you can recommend would be greatly appreciated.

    Kind regards

    David

  16. #16
    Member
    Real Name
    David Nunn
    Join Date
    Nov 2005
    Posts
    88

    Default

    Just as an addendum to the above, I got the following to work on a form:

    total(PREPAY1->Score,GRP->Phones,GRP->PREPAY1)

    [Phones being the master table, and Prepay1 being the link to a child table on product name]

    However, this field gets left out when I export to excel. And if I try and use the same calculation in a table it tells me it's not appropriate.

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

    Default

    Quote Originally Posted by cellboy
    Just as an addendum to the above, I got the following to work on a form:

    total(PREPAY1->Score,GRP->Phones,GRP->PREPAY1)

    [Phones being the master table, and Prepay1 being the link to a child table on product name]

    However, this field gets left out when I export to excel. And if I try and use the same calculation in a table it tells me it's not appropriate.
    If you look at the documentation for total() (and average(), min(), etc.) you will see that these functions are intended for use in the report writer. They will function on a form where the usage of the GRP-> parameter makes sense (or where the optional group parameter is not used). They do not work in calculated field rules.

    Try using tablesum() or dbsum() in the table calculated field definition.

    You may have to construct a temporary table which is emptied and repopulated before each export, combining fields from all the involved tables.

  18. #18
    Member
    Real Name
    David Nunn
    Join Date
    Nov 2005
    Posts
    88

    Default

    DBSUM has done the trick, thank you. Although there are many aspects where Alpha 5 is easier/more intuitive to work with than Filemaker, I don't think this is one of them! Once you've done it once, I can see it is not too hard though.

Similar Threads

  1. importing individual data from different databases
    By phillip dziewior in forum Alpha Five Version 7
    Replies: 9
    Last Post: 12-17-2005, 11:16 AM
  2. Save letters to Individual files when being produced.
    By OOsorio in forum Alpha Five Version 6
    Replies: 2
    Last Post: 11-21-2005, 03:13 AM
  3. Mass Configuration vs Individual
    By Scott Fisher in forum Alpha Five Version 6
    Replies: 6
    Last Post: 08-05-2005, 03:43 AM
  4. Encrypt Individual Field(s)
    By John Gamble in forum Archived Wishlist
    Replies: 2
    Last Post: 02-24-2005, 03:38 PM
  5. Showing individual tax rates on report
    By Greg Fong in forum Alpha Five Version 4
    Replies: 1
    Last Post: 08-19-2001, 05:54 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
  •