dbTalk Databases Forums  

Should be a simple Count Of...

comp.databases.filemaker comp.databases.filemaker


Discuss Should be a simple Count Of... in the comp.databases.filemaker forum.



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

Default Should be a simple Count Of... - 05-17-2007 , 02:04 PM






Ok, I got this to work, but it was ugly.
I have an Age Report I compile monthly for patients.
<20
20-29
30-39
40-49
50-59
60+

Say 30-39 age group:
patientage - calc field via DOB
##tag - calc field
##tagcount - summary count of field (this works):

30tagcount, Summary Field, Count Of
=Count Of 30tag

What did not work:
30tag, Calc Field, Unstored
Case(
patientage>"29" and patientage<"40";1;
"")

What did work:
Case(
patientage = "30";"1";
patientage = "31";"1";
etc...
patientage = "39";"1";
"")

Like I said, it is working, but I would like it to be a bit more
elegant for the next developer that may work on this... Sometimes it
just feels like I am kludging things together.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Reality is the leading cause of stress...
....amongst those in touch with it.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
WinXP Pro 64Bit / FMP Adv 8.5v2
VoicesInMyHead
a.k.a. The Voices
No, we're not... Yes, we are...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Default Re: Should be a simple Count Of... - 05-17-2007 , 03:42 PM






In article <1179428654.777652.309850 (AT) w5g2000hsg (DOT) googlegroups.com>,
VoicesInMyHead <voices.imh (AT) gmail (DOT) com> wrote:

Quote:
Ok, I got this to work, but it was ugly.
I have an Age Report I compile monthly for patients.
20
20-29
30-39
40-49
50-59
60+

Say 30-39 age group:
patientage - calc field via DOB
##tag - calc field
##tagcount - summary count of field (this works):

30tagcount, Summary Field, Count Of
=Count Of 30tag

What did not work:
30tag, Calc Field, Unstored
Case(
patientage>"29" and patientage<"40";1;
"")

What did work:
Case(
patientage = "30";"1";
patientage = "31";"1";
etc...
patientage = "39";"1";
"")

Like I said, it is working, but I would like it to be a bit more
elegant for the next developer that may work on this... Sometimes it
just feels like I am kludging things together.
Assuming PatientAge is a Calculation returning a Number result then the
original Case should work. To make certain the test is being performed
properly you could add some extra brackets / parentheses around each
individual part.
eg.
Case ((PatientAge > 29) and (PatientAge < 40),
1,
"")

Of course, since FileMaker is very forgiving about using Text function
with Number fields (and vice-versa) you could always just test the
first digit.
eg.
Case (Left(PatientAge, 1) = 3,
1,
"")

But you may have a problem if patients can be single digit ages and
would have to return to a double test anyway (again using extra
brackets to make sure it is performed properly).

eg.
Case ((Left(PatientAge, 1) = 3) and (Length(PatientAge) = 2),
1,
"")

The there's probably many mathematical methods, but why over-complicate
it.

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


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

Default Re: Should be a simple Count Of... - 05-17-2007 , 03:44 PM



On May 17, 3:04 pm, VoicesInMyHead <voices.... (AT) gmail (DOT) com> wrote:
Quote:
Ok, I got this to work, but it was ugly.
I have an Age Report I compile monthly for patients.
20
20-29
30-39
40-49
50-59
60+

Say 30-39 age group:
patientage - calc field via DOB
##tag - calc field
##tagcount - summary count of field (this works):

30tagcount, Summary Field, Count Of
=Count Of 30tag

What did not work:
30tag, Calc Field, Unstored
Case(
patientage>"29" and patientage<"40";1;
"")

What did work:
Case(
patientage = "30";"1";
patientage = "31";"1";
etc...
patientage = "39";"1";
"")

Like I said, it is working, but I would like it to be a bit more
elegant for the next developer that may work on this... Sometimes it
just feels like I am kludging things together.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Reality is the leading cause of stress...
...amongst those in touch with it.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
WinXP Pro 64Bit / FMP Adv 8.5v2
VoicesInMyHead
a.k.a. The Voices
No, we're not... Yes, we are...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Numbers shouldn't be in quotes. They're just numbers. I'm not sure
if that's what's causing the calc to fail, but I wouldn't be
surprised.

In the interest of elegance...

I'm assuming you have a tag and tagcount field for each age range.
That's unnecessary and defeats the purpose of summary fields. You
only need two fields, one calc to determine the age category and one
summary field which counts the primary key of the patient records when
sorted by your age category field.

Your calc field could be
Case(
age <20; 1
age < 30; 2;
etc etc
)


G



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

Default Re: Should be a simple Count Of... - 05-17-2007 , 05:06 PM




Quote:
Assuming PatientAge is a Calculation returning a Number result then the
original Case should work. To make certain the test is being performed
properly you could add some extra brackets / parentheses around each
individual part.
eg.
Case ((PatientAge > 29) and (PatientAge < 40),
1,
"")

Of course, since FileMaker is very forgiving about using Text function
with Number fields (and vice-versa) you could always just test the
first digit.
eg.
Case (Left(PatientAge, 1) = 3,
1,
"")

But you may have a problem if patients can be single digit ages and
would have to return to a double test anyway (again using extra
brackets to make sure it is performed properly).

eg.
Case ((Left(PatientAge, 1) = 3) and (Length(PatientAge) = 2),
1,
"")

The there's probably many mathematical methods, but why over-complicate
it.

Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)- Hide quoted text -

- Show quoted text -
Yeah, it's weird. I am also not using a summary part, and the results
are simply exported into an excel sheet. I'll try some of these
tomorrow. Thanks!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Reality is the leading cause of stress...
....amongst those in touch with it.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
WinXP Pro 64Bit / FMP Adv 8.5v2
VoicesInMyHead
a.k.a. The Voices
No, we're not... Yes, we are...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



Reply With Quote
  #5  
Old   
VoicesInMyHead
 
Posts: n/a

Default Re: Should be a simple Count Of... - 05-17-2007 , 05:17 PM




Quote:
Numbers shouldn't be in quotes. They're just numbers. I'm not sure
if that's what's causing the calc to fail, but I wouldn't be
surprised.
Hmm... never thought about that - I think I've always put them in
quotes - I'll check that out.

Quote:
In the interest of elegance...
I'm assuming you have a tag and tagcount field for each age range.
You assume correctly

Quote:
That's unnecessary and defeats the purpose of summary fields. You
only need two fields, one calc to determine the age category and one
summary field which counts the primary key of the patient records when
sorted by your age category field.

Your calc field could be
Case(
age <20; 1
age < 30; 2;
etc etc
)

G-
This is true. I guess I could make a summary part for them. Right
now I have each category Count Of field thrown in the header of a
corresponding layout, with an export button. It works well in the
"back office" layouts, that only IT has access to... no one wants it
pretty, just functional.

I guess I am trying to merge the two a little bit. Our new IT
Director is moving the shop to SQL - man what a culture shock! It'll
be a while before I can do with Microsoft products (if at all) that I can do
with FMP.
Thanks Grip!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Reality is the leading cause of stress...
....amongst those in touch with it.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
WinXP Pro 64Bit / FMP Adv 8.5v2
VoicesInMyHead
a.k.a. The Voices
No, we're not... Yes, we are...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



Reply With Quote
  #6  
Old   
Paul Bruneau
 
Posts: n/a

Default Re: Should be a simple Count Of... - 05-18-2007 , 06:57 AM



On May 17, 6:17 pm, VoicesInMyHead <voices.... (AT) gmail (DOT) com> wrote:

Quote:
I guess I am trying to merge the two a little bit. Our new IT
Director is moving the shop to SQL - man what a culture shock! It'll
be a while before I can do with Microsoft products (if at all) that I can do
with FMP.
Update your resume and get out while your system is still in place.
Leave the horrible switchover to someone else.



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.