![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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. |
#3
| |||
| |||
|
|
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... -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
#4
| |||
| |||
|
|
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 - |
#5
| |||
| |||
|
|
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- |
#6
| |||
| |||
|
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |