dbTalk Databases Forums  

Counting problem

comp.databases.filemaker comp.databases.filemaker


Discuss Counting problem in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mattG
 
Posts: n/a

Default Counting problem - 03-07-2007 , 01:16 AM






I am attempting to do some counting. I am able to get a count of what
I need a count of, however it is a grand total. I am using summary
fields which I have created, to count the number of fields which
appear. However I am attempting to get it to do this, and count
number of instances.

An example is that say I have various things. These things are red,
blue, and green. I want a count orf the total number of things, and
the number of red, number of blue, and number of green. While all of
these things still fall under the things field.

Thanks,

Matt


Reply With Quote
  #2  
Old   
Brent
 
Posts: n/a

Default Re: Counting problem - 03-07-2007 , 04:52 AM






I have ran into this a lot and this does work, but a litlle cumbersome at times. If
anyone knows a better way to do this, PLEASE let me know by email.

Define a unstored calculation field Flag = If( Things = "", 0, 1)
Then do a Summary on gFlag. That way you are just counting 1's.

Where it gets to be very cumbersome is if you have to count red, and blue separately
- especially if you have many different types of items.

Reply With Quote
  #3  
Old   
Bill
 
Posts: n/a

Default Re: Counting problem - 03-07-2007 , 05:35 AM



In article <1173251791.510542.5340 (AT) 8g2000cwh (DOT) googlegroups.com>,
"mattG" <mgohring (AT) gmail (DOT) com> wrote:

Quote:
I am attempting to do some counting. I am able to get a count of what
I need a count of, however it is a grand total. I am using summary
fields which I have created, to count the number of fields which
appear. However I am attempting to get it to do this, and count
number of instances.

An example is that say I have various things. These things are red,
blue, and green. I want a count orf the total number of things, and
the number of red, number of blue, and number of green. While all of
these things still fall under the things field.

Thanks,

Matt
Several ways of doing this.

The simplest is to define a summary field Count(Item) where Item is a
field that is always filled in the record. Then put a subsummary part in
a suitable layout, with the subsummary set to work when sorted by x,
where x is the field that contains the attribute you want to count --
color in the example you give. Then sort the records by that attribute,
and switch to the preview mode. Subsummaries do not show up in the
Browse mode, only in the Preview mode or in the printed document.

You can also use the GetSummary function in a calculation.

Another way is by means of relationships, with several relationships
each based on a different color. In the master table define a
calculation field Count(Red::Item), where Red is the related table
occurrence based on the relationship to red, and so on for the other
colors. The Master table would contain a global field that holds the
word "Red" with the relationship defined as:

Master::GlobalWordRed = Related::Color

with similar global fields and relationships for the other colors.

Another way, that also depends on a relationship, is to define calc
fields with If statements, thus:

Red = if(Color = "Red";"x";""),

then define a calc field in a master table thus:
CountRed = Related::Count(Red)

Still another is to do a series of scripted Finds, one for each Color,
and count how many records in each found set.

--
For email, change <fake> to <earthlink>
Bill Collins


Reply With Quote
  #4  
Old   
Helpful Harry
 
Posts: n/a

Default Re: Counting problem - 03-07-2007 , 01:45 PM



In article
<bbcollins-B941E8.06350607032007 (AT) customer-201-125-217-207 (DOT) uninet.net.mx>,
Bill <bbcollins (AT) fake (DOT) net> wrote:

Quote:
In article <1173251791.510542.5340 (AT) 8g2000cwh (DOT) googlegroups.com>,
"mattG" <mgohring (AT) gmail (DOT) com> wrote:

I am attempting to do some counting. I am able to get a count of what
I need a count of, however it is a grand total. I am using summary
fields which I have created, to count the number of fields which
appear. However I am attempting to get it to do this, and count
number of instances.

An example is that say I have various things. These things are red,
blue, and green. I want a count orf the total number of things, and
the number of red, number of blue, and number of green. While all of
these things still fall under the things field.

Thanks,

Matt

Several ways of doing this.

The simplest is to define a summary field Count(Item) where Item is a
field that is always filled in the record. Then put a subsummary part in
a suitable layout, with the subsummary set to work when sorted by x,
where x is the field that contains the attribute you want to count --
color in the example you give. Then sort the records by that attribute,
and switch to the preview mode. Subsummaries do not show up in the
Browse mode, only in the Preview mode or in the printed document.

You can also use the GetSummary function in a calculation.

Another way is by means of relationships, with several relationships
each based on a different color. In the master table define a
calculation field Count(Red::Item), where Red is the related table
occurrence based on the relationship to red, and so on for the other
colors. The Master table would contain a global field that holds the
word "Red" with the relationship defined as:

Master::GlobalWordRed = Related::Color

with similar global fields and relationships for the other colors.

Another way, that also depends on a relationship, is to define calc
fields with If statements, thus:

Red = if(Color = "Red";"x";""),

then define a calc field in a master table thus:
CountRed = Related::Count(Red)
This one of course doesn't need a relationship. You can define the
first "If" Calculation field in any table, and then use a normal
Summary field in the same table to "Count" this field.



Quote:
Still another is to do a series of scripted Finds, one for each Color,
and count how many records in each found set.




Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.