Combine data from two lists into one new list


#1

I am trying to combine two lists to one list based on the same code in Both lists.

Please see the picture below.

I have two lists

The first list is a list with Items. every Item has a specific number.

The second list contains Item description and color.

In this list are the same specific numbers

Based on the number in list one I want to search for that number in list two combine the info to a new list.

Any suggestions how to manage that in Dynamo?
combine lists


#2

This may be a little more complex than what it should but is what i could think of to get you to your end goal from the beginning two lists.

 

Dynamo File: help

 

List help


#3

File: CombineData.dyn


#4

File: CombineData-Nodes.dyn

20150927-5


#5

Vikram - i thought there would be a similar way to do exactly the same which you have proven there is:)


#6

Great solution, Vikram.

I have a small suggestion. I think that back in version 0.8, they fixed a regression with node lacing and a lot of nodes that could not handle lists and needed a “List.Map” node, started working again. So that means that if you set lacing to longest, you can omit the “List.Map” node. That’s not the case with “IndexOf”, unfortunately. However if we use “List.FirstIndexOf” instead, we can get rid of that “List.Map” as well.

2015-09-28_10-53-11


#7

Didn’t even cross my mind that lacing could make the solution so much better. Thanks.


#8

Very nice solution Dimitar, seeing the variation probably helps with getting to know the software and how things can work outside of what you may originally thought it was for.


#9

Very nice indeed.

Can one of you tell me how I solve the following problem?

I created a list from Excel with numbers. For example Kolom A with the following numbers. 100,200,300

When reading the file into a list Dynamo will gif me the following: 100.00, 200.00, 300.00

When comparing them with my list from Revit parameters the two lists do not match.

How do I convert the list from Excel to the same format as the list from Revit.

Is there a integer to string conversion?

combine lists 2


#10

I think this is a previously discussed issue in some other post, and the main outcome is that you will need to round the values first via the rounding node.


#11

If you are confident in your formatting, you can use String.FromObject to convert the values from excel into a string. Then you can use “String.Split” with “.” as the separator and then feed that result through a List.Map with List.FirstItem as the function. This is essentially throwing away the decimal and everything to the right of the decimal.


#12

I worked with the solution Vikram provided.

With this example I want to update Description parameters in families.

I face a new problem with this.

The top list is the data from Revit

The bottom list is the data that comes from a Excellist.

So one Item from the top list is not available in the bottom list.

This results in a -1 value in the List.Map and a error and null value in the List.GetItemAtIndex. See yellow Node.

This results in a List.Combine Node at the end. When I use this principle in my routine to update de Description it results in wrong information in the families.

Is there a simple way to remove the -1 index from the List.Map zo I get a list without the Null values?

combine lists 4


#13

If you look at the attached image(option 1) which i had posted else where on this forum, it indicates what to do with the “-1” via doing a == node then filtering by boolean.

 

Pile Foundation