Pairing Data according to criteria - Dictionary

Hi All,

I’m trying to put some information in a wall from a database I have in an excel sheet.

The walls selected (Select Model Elements) have the same pier number (tag) to identify, this information I can get easly (Element.GetParamaterValueByName). Also I get the “Top Constraint” value with the same node to identify the element according to story level.

I want to “search” in my Excel Sheet by Pier Number and get the info from Number of Bars and Bar Diameter related to each story.

Here is an image to illustrate what I’m looking for:

I took the example from @Vikram_Subbaiah in LOGIC If value matches a value in a dictionary , append associated value but I only can relate according to story levels.

Any suggestions will be appreciated.

Thanks in advance.

Not sure I totally get your issue, but there’s a node called Element.FilterByLevel in Chynamo. Is this what you need?

@Yna_Db, Hi;

The package recommended is a good tool, but for my issue I only need to make 2 filters, I think I managed to do it by this Filter.ByBooleanMask node and the do the filter by stories:

Any suggestions?

Thanks in advance!

@Jorge_Villarroel

One way could be to join the wall number and the story in one string ( for both the walls and the data coming from excel).

Then search every element of list 1 in list 2 (see picture) and find the index.

From there it’s quite easy use the Element.SetParameterByName node.

I hope this make sense.

I did not replicate this situation but to me, a Dictionary.ByKeysValues node (spring nodes) makes sense here: Walls have a tag (=keys) to identify elements in Excel sheet (=values), and you need to search by ‘Pier Number’ (=search keys). See in the thread you mentioned:

1 Like

Thanks. I’ll take a look at this.

Regards

@Jorge_Villarroel

You would possibly be better off using a true database rather than Excel.
By doing this, a simple SQL query, used in conjunction with GetParameter & SetParameter would do what you want

SELECT [bars] from [table] where [pier]=pier AND [level]=level

Refer Using SQLite instead of Excel
It might seem daunting, but is really quite easy.

1 Like

You can use dictionaries if you don’t want to get into SQL as Andrew is suggesting. Something like this:

2 Likes

Thanks @Andrew_Hannell. I didn’t know about those databases. I’ll give them a try.

Dear Regards.

Thanks @jostein_olsen, I will try both of the suggested options and compare from which I could get a faster response.

Thanks a lot for your time.

Dear regards.