Hopefully this is enough information to get some help. I have only been using Dynamo for a week.
To keep things simple, I have a list that reads as:
List
0 1000
1 2000;3000;4000
2 5000;6000
I need the end result to be:
List
0 1000
1 2000
2 3000
3 4000
4 5000
5 6000
The number of indexes and the number of items in each index (separated by a semi-colon) will vary (will be pulled in from model elements in a Revit file/excel sheet). My understanding is I will need something that acts recursively (or in a loop of some sort). I have been unable to make use of String.Split node when working recursively. I can however, get it work work if I specify the index in the list.
Not sure if I’m understanding the question entirely, but I think you have a list of lists with varying depth that you want to flatten out so it’s only one level deep.
If you’re after a string where you have a ; and want to split the values at the “;” there is no need for recursion either. Run the string.split as you were inclined and then flatten to taste.
You might want to give the primer a good read and do a few of the tutorials, specifically with the modules involving lists and strings. A lot of it will be covered there and lists are a rather difficult item to grasp until you’ve worked with them for a bit.
@Weston Seems like all you need is a simple Flatten node (as suggested above)
But as you haven’t provided screenshots of your attempts it has led to speculation on what your problem might be.
In future, please try to provide screen shots instead of trying to express the list structure here with indices, semi colons etc
Thank you all for the replies! let’s chalk the lack of info on my original post to it being the end of day on a Friday, haha. I have read through the primer a number of times and keep going back to it for reference.
What I am trying to do in more detail: I have a number of elements (my case doors at the moment) in my Revit file. I am exporting a schedule into excel (including the element ID’s). Eventually, that data will be brought back into Revit with changes updating the elements in Revit. Using the element ID’s allows me to update existing in model items or create new ones if the element ID is not found (new line item added in the excel sheet by the architect).
The Code Block is the element ID brought in from an excel sheet (you can see the list in the Watch node). Regardless of the type of string node I try to put this into, I get the same warning you see in the screenshot pop up. I know I must be missing something simple but for the life of me, I just can’t seem to get it to work.
(Nodes shown in image below is as @Einar_Raknes showed above)
The problem here is the data types. This is probably not well enough explained in the primer, because it is something a lot of non-programmers struggle with.There are Stings, Doubles, Integers and Booleans (and some more: https://msdn.microsoft.com/en-us/library/cs7y5x0x(v=vs.90).aspx)
Some of the element Ids are probably integers and needs to be converted to strings for String.Join to work.
That would do it! The single lines are doubles and the lines with the ; seperator are strings by default. Looks like it causes some extra zeroes when converting the double but I can handle that and the rest from here. Thanks for the help @Einar_Raknes, much appreciated! Time to get coding again.