3 Replies Latest reply on Nov 16, 2012 10:53 AM by Pstone

    How Do You: Count number of same text data occurrences in a field?

    Pstone

      Title

      How Do You: Count number of same text data occurrences in a field?

      Post

           What i'm trying to do:

           I have an inventory database. The main database is an entry for each 'asset' we own. In this database there is a field, "MODEL #". This "MODEL #" points to a "MODELS" relational database for pulling up info on that one model such as a picture of it, dimensions, weight, power requirements, etc

           On the main search screen where people can view everything, specific model names, etc., I have a single line listing that displays:

           MAKE MODEL_NAME MODEL# SERIAL# CATEGORY etc...

           What I would like to accomplish is on that line have a "QTY OWNED" which would equal all the models of the same MODEL # so we know how many we have. This number would most likely live in the "MODELS" relational database but I'm having trouble figuring out how to have that number dynamically be kept up to date.

           So if we own 50 of say model # "A", even if a search reveals less than 50 results of that model, each one will still say 50.

           I can get this to work with specifically sorting a search set by "MODEL #" then using a summary field but that's not what I want, I need this number to be always "ON" and accurate without the need to sort so it needs to be a static calculation.

           Thanks!

           Peter

        • 1. Re: How Do You: Count number of same text data occurrences in a field?
          WebCyed

          ok friend look what you have to do is:
               
               For example if you have a table called data and in that table have a field called model then all you have to do is create a table relationship with the same data table called this is that when your relationships that you send the model field equal records same field model once done then you go and create a new field in the table called summary data set him and tell him CALCULATION type the following code:
               
               count (data2 :: model) options that you shall not store data update cuandosea necessary.
               
               I hope to serve you and understand if I am at your command.

          • 2. Re: How Do You: Count number of same text data occurrences in a field?
            philmodjunk

                 There are three ways to count a group of records: the Count function and a summary field set up to count a never empty field in the table in which it is defined. If you have FileMaker 12, you can also use ExecuteSQL to count records in a table.

                 In your case, if your layout is based on your table of assets, you can set up a relationship linking assets to an added occurrence of Assets linking by the model number. Then, either the count function, defined in a field in Assets to count records from the linked occurrence of assets or a "count" type summary field from the linked occurrence of assets can be placed on your layout to show the total assets with that same asset number.

            • 3. Re: How Do You: Count number of same text data occurrences in a field?
              Pstone

                   Ahh.. .thank you Web Cyed! Worked like a charm! Changes dynamically as well.