ash00182 Posted July 11, 2006 Posted July 11, 2006 if i have have a field with different number values in it ie 1, 2, 3, etc how do i get to count all the number 1,s not so easy for a newbie thank you
Breezer Posted July 11, 2006 Posted July 11, 2006 Try using the function "PatternCount" For example, if you have a field called "NumField" with your numbers, define another field "NumberOnes" as a calculation with PatternCount (NumField, "1"), then a summary field "SumNumberOnes" to count "NumberOnes" defined as "Total of NumberOnes."
LaRetta Posted July 12, 2006 Posted July 12, 2006 Hi ash00182, If there are several numbers in the text field such as [color:green]2, 2, 3, 11, 32, 3 2, 3 then I suggest you break them into a proper relational structure if you can. If you can't, then you need to protect from PatternCount() because the formula given will produce false positives, ie, it would count 11 as two 1's instead of 11. I will refer to your number field as theField. Here is one way you can use a calculation (result is number) = PatternCount ( ¶ & Substitute ( theField ; [ "," ; " " ] ; [ " " ; ¶ ] ) & ¶ ; "¶[color:green]1¶" ) But I suspect this isn't what is needed at all but rather each field contains one number and the need is to count how many records in theField contain 1; how many contain 2 and so on. You can use a report to count them all without creating a calculation for each number. Here is how: Create a new field called sTotalCount, type SUMMARY and specify Count of theField. Then create a new columnar list layout, Report with Grouped Data. Specify fields and select theField and cTotalCount (and any other fields you wish to display in the body). Organize by theField. Sort by theField. Theme & Header/Footer however you wish. Then let FM create the script for you. It is critical that this report be sorted by theField and FM will store the sort in the script, as well as Go To Layout [ thisNewLayout ] and even enter Preview Mode for you. But when it asks, don't go to Preview Mode at fist ... go to Layout mode. The bottom part is your body (which will contain the detail records). If you don't want a body, but only want the totals as: Value 1 = 244 (count of how many records have 1 in theField Value 2 = 122 (etc) ... then take that sTotalCount field and move it up into the same part as theField. Then delete the body part by clicking the part panel to the body ONCE (left tab with 3 dots) then hit DELETE. Switch to Browse and save your layout. Run this new script FM created for you. If you would like a sample file of a report, we can easily provide one - just let us know ... LaRetta :wink2:
ash00182 Posted July 13, 2006 Author Posted July 13, 2006 thanks for reading my post and even more for replying i will try these solutions out and LaRetta if you could send me a sample file i would be grateful
LaRetta Posted July 13, 2006 Posted July 13, 2006 I'd be happy to ... please clarify whether all the numbers are in one field (as 2, 11, 4 etc) or whether the field only contains one number. :wink2:
ash00182 Posted July 14, 2006 Author Posted July 14, 2006 the field only contains one number ie if i do a find and it comes up with 10 results the number field will have 10 separate values ie 1, 2, 5, 1, 3, 6, 11, 8, 9, 1, i need to count all the number ones and not the eleven so the result should say 3 thank you bye
ash00182 Posted July 14, 2006 Author Posted July 14, 2006 hi breeezer i tried this and it works if i only have one find result but if i have 10 finds it lists them all seperatley i need the total of number ones in the 10 find results any more ideas
Recommended Posts
This topic is 6707 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now