2 Replies Latest reply on Jul 14, 2017 8:04 AM by philmodjunk

    Simple Count


      Might be approaching this the wrong way, cause I can't seem to get what seems like a simple task:


      I have the following:





      A form with dropdown that goes to the select user



      A form displaying the records




      [Name] [Level}

      [John] [1]

      [Sally] [1]

      [Peter] [2]

      [Sue] [1}

      [Josh] [2]


      What I am trying to do is have a section on Lay1 that displays the total count of each level, ie:


      Levels 1: 3 Users

      Levels 2: 2 Users


      Should I be using a calculation or summary field? Or would I need to use a script? I initially thought that I could make a calculation field with something like:


      if [(getfield(Level)) = "3"]

      count (Level)



      But clearly that's incorrect


      If someone could point me in the right direction, I'd really appreciate it. Thanks in advance!

        • 1. Re: Simple Count

          here is one way to get to your goal with sub summary

          • 2. Re: Simple Count

            GetField had a different purpose. I suggest that you look it up in help. It can be very useful, but not here.


            The thing is, this is really not a matter of layouts, but of the tables on which you base those layouts. Are both layouts based on the same table or different tables? Is there a relationship linking the two tables? How is it defined?


            On Layout 2 or a layout based on the same table as Layout 2, you might do the following assuming that each row of your data represents a different record:


            1. Make the layout a list view layout
            2. Add a sub summary layout part "when sorted by" Level
            3. Define a "count of" summary field that counts a field in the table. Any field that is never empty will work.
            4. Put the summary field and Name fields into the sub summary part.
            5. Remove the body layout part.
            6. Enter browse mode and sort your records by Level. (layout will be blank until you sort like this.)


            There are other ways to do this, including a related table with one record for each level, but the above is one of the simplest approaches to produce the result you requested.