1 2 Previous Next 22 Replies Latest reply on Aug 3, 2009 4:16 PM by philmodjunk

    Counting found records in a script

    d_a_m

      Title

      Counting found records in a script

      Post

      The database I use tracks information on race, sex, age and contract type(daily or weekly) of union actors on movies.  I enter specific information for each actor using a layout with checkbox sets and value lists.  When the movie ends, I have to prepare a report that shows all of the information on the actors.  This report has numerous fields containing numerous calculations.

      I am driving myself crazy trying to create multiple scripts that could then be combined into one mega-script that would then populate the report layout for the union.  I am sure this is possible; I just don’t know how to do it.

      So far I have created a script to find one specific set of information within the records.
      This info is male lead cast members with daily contracts.  I want a count of these records and then I want to send this count to the report sheet.  This will need to be repeated, using different find parameters, multiple times with all of the results being sent to the same report layout.

      I can’t find a script function that will give me a count of the found record set. However, I have found the field calculation option for Get(FoundCount) but I can’t make it work either.

      Looking for a lot of help here…..

      Thanks






        • 1. Re: Counting found records in a script
          etripoli
             It sounds like you want to use a Summary field.  You can use it in the footer, or in sub-summaries, to perform totals, averages, sums, etc of records in the found set or groups of records.
          • 2. Re: Counting found records in a script
            philmodjunk
              

            After you have used Perform Find to bring up your set of found records,

             

            Set Field [Table::field ; Get ( Foundcount ) ]

             

            will store the current number of found records in a field which can then be part of your report.

            • 3. Re: Counting found records in a script
              d_a_m
                

              Thanks for the help, that totally works.  It counts the found records and puts them in the proper field in the report.

              Now, how do I make it do this for more scripts but show all of the results on the report at the same time?

               

              I copied the original script and altered to find the next category. I now have a script that performs both scripts but it only displays the info from the last script.

              The script is:

              perform script  [a]

              perform script [b] 

               

              I think I am missing a step

               

              A little more help please..

               

              Thanks

              • 4. Re: Counting found records in a script
                philmodjunk
                  

                Etripoli's suggestion to use a summary report may be the best approach--can't really tell without knowing more about what you are wanting to do.

                 

                To specifically answer the question, You can use set field with get (foundcount) to capture record counts but store the counts in different fields and/or records.

                 

                perform find []

                Set Field [table::field1; get (foundcount) ]

                 

                Perform find []

                Set field [table::field2 ; get (foundcount) ]

                 

                There are also ways to use the count function or a "count of" summary field to count records.

                 

                If you can spell out what you want to do in more detail, we can give you a more detailed response.

                • 5. Re: Counting found records in a script
                  d_a_m
                    

                  I will try to elaborate.

                   

                  The first script I wrote and that you helped me finish was for male lead cast members with daily contracts.  With your help, this script find those records, gets a count and displays the count in the report field of my choice.

                   

                  Now that the first script is done, I need it to also find the male lead cast members with WEEKLY contracts.  Finding this group is not an issue.  Having it display this info in the report in the proper field is not an issue either.  The issue is showing both results, daily and weekly contracts, at the same time in the report. 

                   

                  After those 2 script are done and display info in the report, I move onto female lead cast members with daily contracts and then onto weekly.  This process continues for numerous categories(different races, contract types, ages, etc.) and I need all of the "get(foundcount)"s to display at the same time in the same report.

                    

                   Does this help?

                  thanks again 

                   

                   

                   

                  • 6. Re: Counting found records in a script
                    philmodjunk
                      

                    A sub-summary report will probably be a far simpler approach.

                     

                    Look up this feature in the on line help to learn more about it.

                     

                    Can you list all the records and sort them so that each group of records that you need to count appears grouped together by the sort?

                     

                    If so, you can use a sub-summary report to count all your records and you won't have to script a count of each category.

                     

                     

                    • 7. Re: Counting found records in a script
                      d_a_m
                        

                      I am all for the simpler approach.

                       

                      I looked up a sub summary report.

                       

                      I can list all the records and sort them so that each group of records I need to count appears grouped together.

                       

                      Because each record has different values that I am grouping together, I am having issues with the summary fields.  It only allows for one choice of field.  I need multiple fields with multiple values for the summary field for each category...

                       

                      Am I doing something wrong?

                      d

                       

                      • 8. Re: Counting found records in a script
                        philmodjunk
                          

                        You can use summary fields to return a sub-total for each group.

                         

                        Simply place the field in a sub-summary part and your summary field will return a subtotal instead of a total.

                         

                        Example.

                         

                        Two fields in our table Fruit, FruitCount

                         

                        Define Fruit as text and FruitCount as a Count of Fruit summary field.

                         

                        You can get a report that looks like this

                        Apples         3

                        Strawberries 2

                        Kiwis           1

                         

                        Your sorted records would look like:

                        apples

                        apples

                        apples

                        strawberries

                        strawberries

                        kiwis

                         

                        You would place the fruit and fruitcount fields in a sub-summary part "sorted by fruit".

                        To eliminate listing the individual records above/below the sub-summary part, you click on the body part tag and press delete to delete it.

                        • 9. Re: Counting found records in a script
                          d_a_m
                            

                          ok.

                           

                          Will this is inturn work for apples pick on wednesday by bob?

                          And kiwis picked on friday by sheila?

                           

                          Thanks

                           

                          • 10. Re: Counting found records in a script
                            d_a_m
                              

                            Is it possible to send you a pdf of my layout so you can see what I dealing with?

                            d file:///Users/D/Desktop/Sag%20Data%20Sheet.pdf


                            • 11. Re: Counting found records in a script
                              philmodjunk
                                 You can post screen shots to site that lets you post images and then you can post a message here that links to that image. (Check out the "tree" icon in the toolbar above a message you are typing.)
                              • 12. Re: Counting found records in a script
                                philmodjunk
                                  

                                d_a_m wrote:

                                ok.

                                 

                                Will this is inturn work for apples pick on wednesday by bob?

                                And kiwis picked on friday by sheila?


                                That depends on the structure of your database, how you design the layout and how you sort your found set of records.


                                • 13. Re: Counting found records in a script
                                  etripoli
                                    

                                  d_a_m wrote:

                                  ok.

                                   

                                  Will this is inturn work for apples pick on wednesday by bob?

                                  And kiwis picked on friday by sheila?

                                   

                                  Thanks

                                   


                                   

                                  Yes, most likely, particularly because you can have multiple sub-summary parts on a layout, and sub-summaries can be based on calculated fields.  You could have the first subsummary based on day of the week, the next one based on person, then a third one based on activity, and have the summary field total any (or all) of the records in each group.


                                  • 14. Re: Counting found records in a script
                                    d_a_m
                                      

                                    Link to Screen grabs

                                     

                                     

                                    Sorry it took me awhile to get you the link.  i took screen shots of the data enrty sheet, showing multiple fields and multiple value lists for each record, and the report in which I would like to display all the sorted and found data from the multiple records that fit each category.

                                     

                                    I am still trying to figure out how to show all of the info in the report. 

                                     

                                    Hopefully this gives you a better idea of what i am trying to do.

                                     

                                    Thanks

                                     

                                    1 2 Previous Next