Announcement

Collapse
No announcement yet.

Counting occurrences of alike items in a sublist

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Counting occurrences of alike items in a sublist

    Hey gang

    As part of an audit for a project file that got waaaay out of hand in a Tender rush last year, and to equip myself for future efforts of the same, I'm attempting to build a script to do the old "where does this junk live so I can check it before I nuke it"

    Annotation mostly

    And whilst I have found it relatively easy so far to query:
    a. which views detail lines (sorry curves) live on
    b. the number of detail curves on each view
    c. detail curve types
    d. the total number of times each detail curve type is used

    ...I am struggling to get a the "count of each detail curve type per each view", with a mind to generate something like:

    matrix.png

    i.e.
    >Plan
    >>Medium Line =2
    >>Wide Line =3
    >Section
    >>Medium Line =2
    >>Wide Line =3

    so that: Medium Lines = 4 & Wide Lines =6


    I've tried mutliple combinations of List.GroupByKey, lacing and level variations on List.Count, String.Occurences etc but keep coming up short (or more often turned around facing the same set of output) where the big blue question mark lives:
    Capture.PNG

    not a-lot of value-add sharing the .dyn as it's front-loaded with a heap of custom SP filters - but I can pare it back if it'll help response (?)
    Last edited by snowyweston; March 11, 2021, 01:18 PM.

    #2
    Hi Snowy,

    I think I'm not getting the full question. If I read this:
    i.e.
    >Plan
    >>Medium Line =2
    >>Wide Line =3
    >Section
    >>Medium Line =2
    >>Wide Line =3

    so that: Medium Lines = 4 & Wide Lines =6
    Then you can solve it by this:

    linetype_count.png

    But it seems you alreay have that info at the bottom of your example.

    Can you maybe indicate the desired outpunt in a list format?

    Comment


      #3
      no worries Bjorn, I know I waffle!

      Yours is, as you note, my item d. (the total count of each type)
      whereas I'm after the total-of-each-type-per-view.


      picturing/describing it as a list is fundamentally my problem as well! :laugh:

      edit

      0 List
      View
      CountTotal
      TL
      HL
      D
      HL
      WL
      1 List
      Plan
      10
      3
      2
      2
      2
      1
      2 List
      Section
      5
      1
      1
      1
      1
      1

      with the idea being i get a .csv
      View,CountTotal,TL,HL,D,ML,WL
      Plan,10,3,2,2,2,1
      Section,5,1,1,1,1,1


      ...I know i don't need the count column for downstream, but its helping be keep (some) track of the numbers.
      Last edited by snowyweston; March 11, 2021, 02:23 PM.

      Comment


        #4
        Take a look at this, I might still not get the result you're after.

        linetypes_views_#.png

        *Sorry, got to playing around with this before you made your edit. Including the totals into this is not a big deal if that is a must
        Last edited by Bjorn_K; March 11, 2021, 02:38 PM.

        Comment


          #5
          I think this is it, only I realised later I sorted it the other way around.

          linetype_example_2021-03-11_04-49-57.png
          Attached Files

          Comment


            #6
            that's the ticket!


            I got hung up in my search for "alike" items, but kept getting the same counts for type, not something that uniquely identified each instance - and I didn't even think to count indices!!!

            :hide:

            so 1,2, skip a step and here we are!

            almost.PNG

            :bb:

            ...now to break down that "view column" output to Family,Type,Name and I'll be set to run this on the model with 3273 views and 102 linestyles! :laugh:

            Cheers as always Bjorn!

            Comment


              #7
              Nice!

              Always fun to dive into these details nowadays, my new job has got me a little more removed from day to day project work.

              Comment

              Related Topics

              Collapse

              Working...
              X