Thanks! Error’s gone but the node doesn’t seems to work as intended. Or actually at all…
I’m quite fresh to C# and I run into an issue that not all the basic knowledge can be found on the internet in digestible form. For example, I knew there was a problem with type’s of something (VS thankfully show’s the problem) but how on earth could I ever knew that it’s possible to cast one thing as simple as with, well as . There aren’t any tutorials showing specifically that so it’s impossible to search for them. So somebody like me who’s trying to learn everything on his own, is dependent on somebody like you who thankfully there to answer questions like this.
Well, almost everthing regarding c# problems that you gonna encounter, or encountered can be found in stackoverflow, or should i say google will be your best friend in this. I myself doesnt has any programming background when i first step into dynamo and i manage to solve almost all the issue (even though it might not be the cleanest way to do it ) using google. so i got to disagree with you on that point.
With that being said, maybe you can describe more about your use case and we can see what i can help you from there
Oh don’t get me wrong, the answers are out there that’s for sure. I claim that it’s not easy to search in regards to search terms. At least for me.
If you insist… I’m trying to feed 1D list with strings as headers, 2D list with variable types as data and a single item or 1D list as search term that corresponds with the a term(s) from headers. And retrieve a the requested data. And it’s not working
just to clarify, i have no background of programming so 1D means one dimension list which means there wont be nested list right?
So what you want is basically retrieve items from key in a dictionary right? each headers will have their own list and by feeding the header, it will return the list of data. Am i right?
okay that should be easy (havent tested it out yet but it should be working)
public static IList RetrieveFromColumnHeaderMatrix(IList columnData, List<string> columnHeader, List<string> searchHeaders)
{
List<object> searchlist = new List<object>();
Dictionary<string, object> dict = new Dictionary<string, object>();
for (int i = 0; i < columnHeader.Count; i = i + 1)
{
if (i < columnData.Count)
dict.Add(columnHeader[i], columnData[i]);
}
foreach (string searchHeader in searchHeaders)
{
searchlist.Add(dict[searchHeader]);
}
return searchlist;
}
Basically just add all tables to dictionary values with respective headers as key. Then use search index to search for the right key in the dictionary. thats all