Filter List by Element that is in a List of this List

revit
excel
dynamo
list-filter

#1

Hello Community!

Startet working with dynamo few weeks ago and have my first question because i cant find a solution myself.

I have an Excel Sheet from a Database that will change over time. There are 3 Values in each row of the Excel Sheet (Article Number, Article Name & Weigt). I imported the Excel sheet and get a List with ~5400 Lists in it. Each of this ~5400 lists contain the 3 values that i mentioned above.

Now the thing i need to do is to write these 3 values in a Family. I know the way how to write a parameter in a Family, i only need the way to filter the list that i only get the 3 Values that i need out of these 5400 x 3 values.

The following Picture shows my current node for the import of the Excel sheet:

I want to have now only the List that contains 3 values with the Index 3328 for this specific part. The only way I found is to use “List.GetItemAtIndex”.
Basically this works fine and i get the 3 values that i want and can write them in my family, the problem is that the Index can change everyday for example when we get a new item in our Database (Then the index would be for example 3329).
The only thing that stays always the same is the Article Number which is 586536000 in this case and marked yellow in the picture.
Is there a way to get this list with the 3 Values (586536000, Dokadek Wall Head & 4,33) by filtering with the Articlenumber that is in this list`?


#2

I’m not sure about the specifics that are going on here but there’s the GetItemAtIndex node. I’m guessing that should give you the tools to solve your problem.


#3

Hello,

the problem is that the index can change, the only value that stays always the same is the Articlenumber thats why the get item at index is a “bad solution”


#4

I don’t think it’s too difficult actually, are the indices of the items you want consistently in the 1 and 2 position?
And what’s currently the output you’re getting rom indices node?


#5

Hi, @gerhard.schindler

You can connect the node “If Equal Return Index” to the “GetItemAtIndex” node to create the logic.

Marcel


#6

You have a two options that I can think of:

  1. Transpose the output from Excel.ReadFromFile node, which will result on 3 lists. Search for the index of the desired output on the first list and get the parameters desired from the other two list using that index.

  2. From Dynamo 2.0, Dictionaries will be available so these kind of workflows will be heavily streamlined by querying keys instead of indexes. Until it is released, there is the JsonData package which behaves similarly and provides extra functionalities, like filtering by key and value.


filterListByValueOfNestedList.dyn (17.2 KB)

EDIT: If there is a chance that the value searched for is not on the data, this exception should be handled properly.


#7

Thank you so much guys for your help, i will try and I´m sure your ways will work :slight_smile: