dbTalk Databases Forums  

Finding count of Field matching Value List

comp.databases.filemaker comp.databases.filemaker


Discuss Finding count of Field matching Value List in the comp.databases.filemaker forum.



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

Default Finding count of Field matching Value List - 09-14-2010 , 10:31 PM






Hello good people!

I have a database where I am trying to count the number of times a
value from a value list appears in a field.

I would also like the report to slide up, showing only the values
represented (I have another field I am attempting to organize the
information by.

An example DB would be:

"Company" is a text field that I would like to use to organize the
report. Within "Company", I would like to display counts of each time
another field "Status" equals a value list. So if I have a value list
of:

In complete
In progress
Done

So I would like the report to show all companies, and under each
company, it would show how many records match each value. And it
would slide up to nothing if no records has "Status" equalling those
values.

Can someone help me? Can I clarify anything better?

Reply With Quote
  #2  
Old   
Your Name
 
Posts: n/a

Default Re: Finding count of Field matching Value List - 09-15-2010 , 01:42 AM






"dvfx" <damienvfx (AT) gmail (DOT) com> wrote

Quote:
Hello good people!

I have a database where I am trying to count the number of times a
value from a value list appears in a field.

I would also like the report to slide up, showing only the values
represented (I have another field I am attempting to organize the
information by.

An example DB would be:

"Company" is a text field that I would like to use to organize the
report. Within "Company", I would like to display counts of each time
another field "Status" equals a value list. So if I have a value list
of:

In complete
In progress
Done

So I would like the report to show all companies, and under each
company, it would show how many records match each value. And it
would slide up to nothing if no records has "Status" equalling those
values.

Can someone help me? Can I clarify anything better?
You'll need a new Summary Field to do the counting.

s_StatusCounter Summary Count of Status

This one field can be used to count all the various summary totals you
want - it's simplay a matter of where in the report Layout it is put and how
you Sort the records.

Then you'll need to create the report Layout. Since you don't want any of
the rRecord details, you don't need a Body Part. The report Layout would be
something like:

SUMMARY REPORT //

Quote:
Header
----------------------

[Company Name]

Quote:
Sub-sumamary (sorted by Company)
----------------------

[s_StatusCount] records are [Status]

Quote:
Sub-sumamary (sorted by Status)
----------------------

Page ##

Quote:
Footer
----------------------


where the [] denote Fields.

Now it is simply a matter of Finding the appropriate Records (e.g. Records
within last two months, or Records for the whole of 2007) and sorting them
in the same order as the Sub-summary Parts of the Layout.
i.e.
Company
Status

The Status Sort Order can be either A-Z alphabetically or based on the Value
List order, whichever you want.

Once the Records are Sorted you can go to the above Layout and view it in
Preview Mode or print it.

All done ... except that with this easy method you will get lines in the
report that say, for example:

0 records are In Progress

If you really have to leave out those lines then it gets more difficult.

Helpful Harry )

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

Default Re: Finding count of Field matching Value List - 09-15-2010 , 02:38 AM



On Sep 15, 2:42*pm, "Your Name" <your.n... (AT) isp (DOT) com> wrote:
Quote:
"dvfx" <damien... (AT) gmail (DOT) com> wrote in message

news:42ee603c-75ad-47b3-8135-5a26b0a661de (AT) l32g2000prn (DOT) googlegroups.com...





Hello good people!

I have a database where I am trying to count the number of times a
value from a value list appears in a field.

I would also like the report to slide up, showing only the values
represented (I have another field I am attempting to organize the
information by.

An example DB would be:

"Company" is a text field that I would like to use to organize the
report. *Within "Company", I would like to display counts of each time
another field "Status" equals a value list. *So if I have a value list
of:

In complete
In progress
Done

So I would like the report to show all companies, and under each
company, it would show how many records match each value. *And it
would slide up to nothing if no records has "Status" equalling those
values.

Can someone help me? *Can I clarify anything better?

You'll need a new Summary Field to do the counting.

* * * *s_StatusCounter * * * Summary * *Count of Status

This one field can be used to count all the various summary totals you
want - it's simplay a matter of where in the report Layout it is put and how
you Sort the records.

Then you'll need to create the report Layout. Since you don't want any of
the rRecord details, you don't need a Body Part. The report Layout would be
something like:

* * * * * SUMMARY REPORT * * * * * * * * * * * * * * * * //

* * *|Header
* * *----------------------

* * * * * [Company Name]

* * *|Sub-sumamary (sorted by Company)
* * *----------------------

* * * * * * * * * *[s_StatusCount] records are [Status]

* * *|Sub-sumamary (sorted by Status)
* * *----------------------

* * * * * Page ##

* * *|Footer
* * *----------------------

where the [] denote Fields.

Now it is simply a matter of Finding the appropriate Records (e.g. Records
within last two months, or Records for the whole of 2007) and sorting them
in the same order as the Sub-summary Parts of the Layout.
i.e.
* * * * * *Company
* * * * * *Status

The Status Sort Order can be either A-Z alphabetically or based on the Value
List order, whichever you want.

Once the Records are Sorted you can go to the above Layout and view it in
Preview Mode or print it.

All done ... except that with this easy method you will get lines in the
report that say, for example:

* * * 0 records are In Progress

If you really have to leave out those lines then it gets more difficult.

Helpful Harry *)
Thank you Harry. That is close, but as you mentioned, the displaying
of records for "0" is something my boss does not want.

I've tried to create a separate "Company" based table, and then
replacing occurrences of my primary table layouts with the Company
Table layouts. I've then also tried to make a portal in a report
layout that would slide up if it equals zero. That was a no go.

I've already gone to the trouble of creating subtotals for each
possible value, giving a value of 1, and creating total fields of
those values. I just can't seem to create a report that displays the
information I want.

If you know of another post that has a similar solution for me that
would be great. Thank you for your help Harry!

Reply With Quote
  #4  
Old   
dvfx
 
Posts: n/a

Default Re: Finding count of Field matching Value List - 09-15-2010 , 03:28 AM



On Sep 15, 3:38*pm, dvfx <damien... (AT) gmail (DOT) com> wrote:
Quote:
On Sep 15, 2:42*pm, "Your Name" <your.n... (AT) isp (DOT) com> wrote:





"dvfx" <damien... (AT) gmail (DOT) com> wrote in message

news:42ee603c-75ad-47b3-8135-5a26b0a661de (AT) l32g2000prn (DOT) googlegroups.com....

Hello good people!

I have a database where I am trying to count the number of times a
value from a value list appears in a field.

I would also like the report to slide up, showing only the values
represented (I have another field I am attempting to organize the
information by.

An example DB would be:

"Company" is a text field that I would like to use to organize the
report. *Within "Company", I would like to display counts of each time
another field "Status" equals a value list. *So if I have a value list
of:

In complete
In progress
Done

So I would like the report to show all companies, and under each
company, it would show how many records match each value. *And it
would slide up to nothing if no records has "Status" equalling those
values.

Can someone help me? *Can I clarify anything better?

You'll need a new Summary Field to do the counting.

* * * *s_StatusCounter * * * Summary * *Count of Status

This one field can be used to count all the various summary totals you
want - it's simplay a matter of where in the report Layout it is put and how
you Sort the records.

Then you'll need to create the report Layout. Since you don't want any of
the rRecord details, you don't need a Body Part. The report Layout would be
something like:

* * * * * SUMMARY REPORT * * * * * * * * * * * * * * * * //

* * *|Header
* * *----------------------

* * * * * [Company Name]

* * *|Sub-sumamary (sorted by Company)
* * *----------------------

* * * * * * * * * *[s_StatusCount] records are [Status]

* * *|Sub-sumamary (sorted by Status)
* * *----------------------

* * * * * Page ##

* * *|Footer
* * *----------------------

where the [] denote Fields.

Now it is simply a matter of Finding the appropriate Records (e.g. Records
within last two months, or Records for the whole of 2007) and sorting them
in the same order as the Sub-summary Parts of the Layout.
i.e.
* * * * * *Company
* * * * * *Status

The Status Sort Order can be either A-Z alphabetically or based on the Value
List order, whichever you want.

Once the Records are Sorted you can go to the above Layout and view it in
Preview Mode or print it.

All done ... except that with this easy method you will get lines in the
report that say, for example:

* * * 0 records are In Progress

If you really have to leave out those lines then it gets more difficult..

Helpful Harry *)

Thank you Harry. *That is close, but as you mentioned, the displaying
of records for "0" is something my boss does not want.

I've tried to create a separate "Company" based table, and then
replacing occurrences of my primary table layouts with the Company
Table layouts. *I've then also tried to make a portal in a report
layout that would slide up if it equals zero. *That was a no go.

I've already gone to the trouble of creating subtotals for each
possible value, giving a value of 1, and creating total fields of
those values. *I just can't seem to create a report that displays the
information I want.

If you know of another post that has a similar solution for me that
would be great. *Thank you for your help Harry!
I take that back. This has done EXACTLY that. Thank you Harry, once
again you've lived up to your name :-)

Reply With Quote
  #5  
Old   
Your Name
 
Posts: n/a

Default Re: Finding count of Field matching Value List - 09-15-2010 , 04:22 PM



"dvfx" <damienvfx (AT) gmail (DOT) com> wrote

Quote:
I take that back. This has done EXACTLY that. Thank you Harry, once
again you've lived up to your name :-)
D'oh! Yep, I was wrong in that last part.

Re-thinking it, of course it wouldn't show any "0" lines. With no records of
type "In Progress" (for example) in the sort order for a Company, FileMaker
wouldn't have any Summary Part of the report Layout to display / print for
that Status. I was confusing it with a calulated total in the normal Body
Part.

Helpful Harry )

Reply With Quote
  #6  
Old   
dvfx
 
Posts: n/a

Default Re: Finding count of Field matching Value List - 09-16-2010 , 01:58 AM



On Sep 16, 5:22*am, "Your Name" <your.n... (AT) isp (DOT) com> wrote:
Quote:
"dvfx" <damien... (AT) gmail (DOT) com> wrote in message

news:7f82bf24-92d2-4de9-bb00-d6129625e601 (AT) x18g2000pro (DOT) googlegroups.com...



I take that back. *This has done EXACTLY that. *Thank you Harry, once
again you've lived up to your name :-)

D'oh! Yep, I was wrong in that last part.

Re-thinking it, of course it wouldn't show any "0" lines. With no recordsof
type "In Progress" (for example) in the sort order for a Company, FileMaker
wouldn't have any Summary Part of the report Layout to display / print for
that Status. I was confusing it with a calulated total in the normal Body
Part.

Helpful Harry *)
Helpful Harry, one last problem with this particular report. It all
seems to be running smooth, except I can not seem to get two summary
fields to subtract from each other. Here is the calculation field I
have set-up:

c_Remaining = s_Company - s_FinishedJobs

s_FinishedJobs is a summary field counting a few different exceptable
values:

c_FinishedJobs = Status = "Complete" or
Status = "Canceled" or
Status = "etcetc"

I end up with the [c_Remaining] field returning the total number of
completes. Not how many are remaining. I also attempted a variation
for [c_FinishedJobs] with an If calculations here:

[c_FinishedJobs] = If(Status = "Complete;1;0)
If(Status = "Canceled";1;0) or
If(Status = "etcetc";1;0)

All that does is return the total number of records in the DB. Which
makes sense to me, with so many opportunities for it to return a 0.
Any thoughts on this?

Reply With Quote
  #7  
Old   
Lynn Allen
 
Posts: n/a

Default Re: Finding count of Field matching Value List - 09-16-2010 , 10:27 AM



On 2010-09-15 23:58:41 -0700, dvfx <damienvfx (AT) gmail (DOT) com> said:

Quote:
c_Remaining = s_Company - s_FinishedJobs

s_FinishedJobs is a summary field counting a few different exceptable
values:

c_FinishedJobs = Status = "Complete" or
Status = "Canceled" or
Status = "etcetc"

I end up with the [c_Remaining] field returning the total number of
completes. Not how many are remaining. I also attempted a variation
for [c_FinishedJobs] with an If calculations here:

[c_FinishedJobs] = If(Status = "Complete;1;0)
If(Status = "Canceled";1;0) or
If(Status = "etcetc";1;0)

All that does is return the total number of records in the DB. Which
makes sense to me, with so many opportunities for it to return a 0.
Any thoughts on this?
Rather than messing with math with summary fields, try having each line
calculate whether it's finished or not, then summarize THAT.

So, for each line, make a calc, fNotInProgress = Case(Status =
"canceled" or Status = "Complete" or {more tests for not in progress
here}... ; 1, 0)

Then make a summary field to summarize fNotInProgress. Much simpler
than trying to get a summary to subtract from another summary.

Lynn Allen
FM 10 Certified Developer

Reply With Quote
  #8  
Old   
Your Name
 
Posts: n/a

Default Re: Finding count of Field matching Value List - 09-16-2010 , 10:48 PM



In article
<68033d7e-9049-4f06-a437-1aac1ff621da (AT) q16g2000prf (DOT) googlegroups.com>, dvfx
<damienvfx (AT) gmail (DOT) com> wrote:
Quote:
On Sep 16, 5:22=A0am, "Your Name" <your.n... (AT) isp (DOT) com> wrote:
"dvfx" <damien... (AT) gmail (DOT) com> wrote in message
news:7f82bf24-92d2-4de9-bb00-d6129625e601 (AT) x18g2000pro (DOT) googlegroups.com...

I take that back. =A0This has done EXACTLY that. =A0Thank you Harry,
once again you've lived up to your name :-)

D'oh! Yep, I was wrong in that last part.

Re-thinking it, of course it wouldn't show any "0" lines. With no
records of type "In Progress" (for example) in the sort order for
a Company, FileMaker wouldn't have any Summary Part of the report
Layout to display / print for that Status. I was confusing it with
a calulated total in the normal Body Part.

Helpful Harry, one last problem with this particular report. It all
seems to be running smooth, except I can not seem to get two summary
fields to subtract from each other. Here is the calculation field I
have set-up:

c_Remaining =3D s_Company - s_FinishedJobs

s_FinishedJobs is a summary field counting a few different exceptable
values:

c_FinishedJobs =3D Status =3D "Complete" or
Status =3D "Canceled" or
Status =3D "etcetc"

I end up with the [c_Remaining] field returning the total number of
completes. Not how many are remaining. I also attempted a variation
for [c_FinishedJobs] with an If calculations here:

[c_FinishedJobs] =3D If(Status =3D "Complete;1;0)
If(Status =3D "Canceled";1;0) or
If(Status =3D "etcetc";1;0)

All that does is return the total number of records in the DB. Which
makes sense to me, with so many opportunities for it to return a 0.
Any thoughts on this?
Summary Fields only really work in Summary Parts of a Layout when viewed
in Preview Mode or printed, with the records appropriately sorted in the
case of Sub-summary parts.

For that reason it's not really possible to use Summary Fields in
Calculations, Script commands, Relationship definitions, etc. There is a
Get Summary / Get function that can be used to grab the correct values
from Summary Fields, but, as Lynn Allen suggested, you would be best to
calculate the figures on a "per record" level and then use a new Summary
field to total those calculated values.

If all you need to know is how many are remaining, then you need Fields
something like:

c_Remaining Calculation, Number Result, Unstored
= Case( Status = "Complete"; 0;
Status = "Canceled"; 0;
Status = "..."; 0;
1)

s_Remaining Summary
Total of c_Remaining

Depending on how many possible Status values there are for "Finished" and
"Unfinished" Records, it might be easier to make the tests look for the
unfinished Status values (remembering to swap the 0 and 1 result numbers).
e.g.
c_Remaining Calculation, Number Result, Unstored
= Case( Status = "In Progress"; 1;
Status = "Yet to Start"; 1;
Status = "..."; 1;
0)

Putting the new Summary Field in the appropriate Sub-summary Part of the
report Layout (the By Company one) will make it summarise just those
records for each Company or putting it in a Trailing Summary Part will
summarise all the Found Records.

Helpful Harry )

Reply With Quote
  #9  
Old   
dvfx
 
Posts: n/a

Default Re: Finding count of Field matching Value List - 09-16-2010 , 11:38 PM



On Sep 16, 11:27*pm, Lynn Allen <l... (AT) semiotics (DOT) com> wrote:
Quote:
On 2010-09-15 23:58:41 -0700, dvfx <damien... (AT) gmail (DOT) com> said:







c_Remaining = s_Company - s_FinishedJobs

s_FinishedJobs is a summary field counting a few different exceptable
values:

c_FinishedJobs = Status = "Complete" or
Status = "Canceled" or
Status = "etcetc"

I end up with the [c_Remaining] field returning the total number of
completes. *Not how many are remaining. *I also attempted a variation
for [c_FinishedJobs] with an If calculations here:

[c_FinishedJobs] = If(Status = "Complete;1;0)
If(Status = "Canceled";1;0) or
If(Status = "etcetc";1;0)

All that does is return the total number of records in the DB. *Which
makes sense to me, with so many opportunities for it to return a 0.
Any thoughts on this?

Rather than messing with math with summary fields, try having each line
calculate whether it's finished or not, then summarize THAT.

So, for each line, make a calc, fNotInProgress = Case(Status =
"canceled" or Status = "Complete" or {more tests for not in progress
here}... ; 1, 0)

Then make a summary field to summarize fNotInProgress. Much simpler
than trying to get a summary to subtract from another summary.

Lynn Allen
FM 10 Certified Developer
Hahaha. I hadn't thought about that. Thank you, that worked
perfectly.

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.