Announcement

Collapse
No announcement yet.

key-values

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

    key-values

    any easy way to process 2 lists into 1 key-values list just like dictionary in C#?
    list 1 is like {a, b, a, c, b, a}
    list 2 is like {1, 2, 3, 4, 5, 6}
    result list is like {{a, 1, 3, 6}, {b, 2, 5}, {c,4}}

    edit: or result list like {{a, b, c}, {1, 3, 6}, {2, 5}, {4}}
    Last edited by Ning Zhou; January 25, 2017, 06:43 AM.

    #2
    Hello Ning,

    There are a couple of Dictionary nodes created. Showcased as below:

    Attached Files

    Sol Amour

    Architectural Explorer, Digital warrior, Affectual adventurer and Curious Human Being
    Portfolio Website @ Cargo Collective

    Comment


      #3
      thanks Sol.
      see attached image for the desired results, perhaps OOTB List.Map can solve this issue, isn't it? i'm not quite familiar w/ that OOTB node, maybe Python Script is the only way out?
      Attached Files

      Comment


        #4
        managed to get one of the desired results, still try to figure out another one, using OOTB nodes only
        Attached Files

        Comment


          #5
          managed to get another desired result using python script, must be a way to use OOTB node only like List.Map, anyone?
          Attached Files

          Comment


            #6
            If you can use Python, feel free too! I would simply do my method with an 'Add Item to Front' as you have done.

            Sol Amour

            Architectural Explorer, Digital warrior, Affectual adventurer and Curious Human Being
            Portfolio Website @ Cargo Collective

            Comment


              #7
              last try:

              seems the very simple question, just "merge" 2 list using OOTB nodes only, code block node is OK, but cannot use python script node, anyone?
              Attached Files

              Comment


                #8
                just figured out thanks to Sol and Marcello.
                Attached Files

                Comment


                  #9
                  This way is faster!

                  What it's doing is as follows: List.AddItemToFront is taking the item at Level 1 (3x objects), and adding those objects in to the listat Level. So the 3x objects from the unique keys slot in at the correct tier structure.
                  Attached Files
                  Last edited by amoursol; February 9, 2017, 09:15 AM. Reason: Explanation

                  Sol Amour

                  Architectural Explorer, Digital warrior, Affectual adventurer and Curious Human Being
                  Portfolio Website @ Cargo Collective

                  Comment


                    #10
                    list level option is absolutely beautiful! no need to figure out List.Map anymore for sure, again, Less Is More!

                    Comment

                    Working...
                    X