Hi all,

I’m exporting data to Excel and in my first tests it all went wel.

but then I had 9 piles. Now I have 12 piles and my export list is like:

1

10

11

12

2

3

…

How can I sort the list that 10 comes after 9 and 20 after 19 and so on.

King regards,

Mike

Hi @Mohammad_Nawar,

no, that’s not what I mean. I have a list of lists and in those lists are items like Pile number X- Y- and Z-coordinates.

And this set-up is okay. This is my input list for the “data” input of the “Excel.WriteToFile” node.

But…it’s not in the correct order. If I have 40 Piles in my model and want to export all 40 coordinates to Excel in this moment I get an excel sheet that start like this:

1

10

11

12

13

14

15

16

17

18

19

2

20

21

etc.

So it’s not numeric in order.

I need it to be:

1

2

3

4

5

6

7

8

9

10

11

12

etc.

I thought it would work by adding the 'List.GetItemAtIndex" node and have it get the items at the start of the list (0;)

and that worked…for pile counts under 10! but now as I try my script on a completed project to see if the scripts works like it should. I found out my pile numbering in Excel is not numeric in order.

Can that be fixed?

OH…STOP!

I didn’t notice your second screenshot!

That’s more what I need!

I’ll have a go at it!

I suspect your pilenumbering is strings? Then you may have to pad the strings so you can sort them right.

2 Likes

Hi @Mohammad_Nawar,

Sorry, that second screenshot didn’t work either.

Hi @jostein_olsen,

No, I believe it’s not a string. Hahahaha…at least that’s what I think with my limited knowledge of Dynamo.

Basicly what the script is doing is to get the Pile elements from Revit and use the Survey Point as 0,0 and then combines the list (Pile number, X, Y and Z). Then I want to shuffel all in numeric order…add some headers and then export it to Excel.

(The yellow warning is not relevant)

Sorry to break your heart, Mike, but it is indeed a string, since you are extracting the Mark value of your piles.

Since strings are sorted like I stated, you must either pad the “numbers” or

convert the extracted Mark value to a number using the String.ToNumber node before plugging it into the List.Create node.

2 Likes

@jostein_olsen

String.ToNumber did the trick!!

THANK YOU!!!