Convert Double to Integer

I’m exporting some info to Excel and then later reading it back in.
The problem I’m having right now is with Element IDs.
I thought I was doing List.IndexOf (or List.AllIndicesOf) wrong, but it turns out that when I read the IDs in from Excel, they come in as Doubles, but when I get an Element ID from Revit, it’s an Integer. So they don’t match.
I tried getting around it by setting the readAsStrings option in the Excel.ReadFromFile node, but that’s a global setting, and I have other cells I need to have as numbers.
I’ve also tried Math.Round, but that can’t handle arrays, just single values.

All I really want to do is convert a list of Doubles (123456.000000) to Integers (123456)
(Ive already read these threads:)
http://dynamobim.org/forums/topic/how-to-find-index-for-each-sublist/#post-43035
http://dynamobim.org/forums/topic/indexof-cant-find-multiple-index-really/
http://dynamobim.org/forums/topic/from-decimal-number-to-integer/
They all helped, but nothing worked as a final solution

OK, I found the String.ToNumber node, which helps a bit.
But, still: YEEESH I have to jump through a LOT of hoops converting things back and forth just to compare a number with a decimal to an integer, even if they are have same value.
If Math.Round could handle a List, or if IndexOf could compare a Double and an Integer, I could take a dozen nodes out of my graph.

4 Likes

Math.Round can handle lists. Have you tried to change the lacing? It will not give you a integer type though: