# List.IndexOf not giving desired Result

**URL:** <https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192>\
**Category:** Revit\
**Created:** [November 8, 2018, 9:30am UTC](https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192 "2018-11-08T09:30:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noman\_Khatri](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@Noman\_Khatri](https://forum.dynamobim.com/u/Noman_Khatri)\
**Post date:** [November 8, 2018, 9:30am UTC](https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192/1 "2018-11-08T09:30:28Z")

</div>

![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/9/495649732200fbcf36bc8c77ce3d7bae18d81648.jpeg)

Hi All,  
If you see my Script, I have 75220016 in both my list but List.IndexOf is not able to read it, I don’t know why.  
May be because it is a number ? Because once I add **-1** in both of my list’s, it starts reading it.  
Is there a solution to it?

Thanks.

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [November 8, 2018, 9:35am UTC](https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192/2 "2018-11-08T09:35:19Z")

</div>

You should add an `object.type` node after `Excel Sheet Number` and `Revit Sheet Number` to see what kind of type (string, double, …) you’re trying to compare.

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [November 8, 2018, 9:35am UTC](https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192/3 "2018-11-08T09:35:44Z")

</div>

My first guess would be that the top numbers of “Excel\_Sheet Number” are strings, while the “Revit\_Sheet Number” are integers… By adding “-1” you’re transforming it to a string 🙂

Example:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/3/e3f5792b188a21bb0c906dad44ae1aa480b4485b.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/1/81df36aebc23aec3dfbfa1e83fd328720f181a70.png)  
Edit… You beat me to the punch @Alban_de_Chasteigner 😁

---

<div class="post-metadata">

**Author:** ![Noman\_Khatri](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@Noman\_Khatri](https://forum.dynamobim.com/u/Noman_Khatri)\
**Post date:** [November 8, 2018, 9:50am UTC](https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192/4 "2018-11-08T09:50:58Z")

</div>

Thanks

I tried Changing Excel Numbers to String, it didn’t helped,  
now I don’t know how the change the parameters properties of Revit Sheet Number since it’s an Inbuilt parameter.

Thanks

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [November 8, 2018, 9:52am UTC](https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192/5 "2018-11-08T09:52:30Z")

</div>

Showing your attempts will make it immensely easier to assist you 🙂

---

<div class="post-metadata">

**Author:** ![Noman\_Khatri](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@Noman\_Khatri](https://forum.dynamobim.com/u/Noman_Khatri)\
**Post date:** [November 8, 2018, 10:11am UTC](https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192/6 "2018-11-08T10:11:39Z")

</div>

![01](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/3/b3649bf9241293bbcfeb27dd3223f0dba5dd2807.jpeg)

We are going well,

When converted to string my excel Shows 000000, and that is where the problem is.  
How Can I solve this one now. 🙂

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [November 8, 2018, 10:17am UTC](https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192/7 "2018-11-08T10:17:06Z")

</div>

The trailing zero’es comes from transforming a double (e.g. 2.0) to a string… (dynamo stuff)…  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/1/41c1a12d04444c8a200b927a1306f0cfcfda022a.png)

---

<div class="post-metadata">

**Author:** ![Noman\_Khatri](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@Noman\_Khatri](https://forum.dynamobim.com/u/Noman_Khatri)\
**Post date:** [November 8, 2018, 10:23am UTC](https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192/8 "2018-11-08T10:23:20Z")

</div>

Instead I used a Node from archilab & converted my Revit Sheet Numbers toDouble & It’s working,  
Thanks for your affort @Jonathan.Olesen.

 ![02](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/0/100bc429af208ff70f752afa9b0b16b0ee72f091.jpeg)

---

<div class="post-metadata">

**Author:** ![AdamHamilton](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@AdamHamilton](https://forum.dynamobim.com/u/AdamHamilton)\
**Post date:** [November 16, 2018, 7:44pm UTC](https://forum.dynamobim.com/t/list-indexof-not-giving-desired-result/28192/9 "2018-11-16T19:44:28Z")

</div>

im getting this issue but its not a data type issue. when i have auto lacing it returns the first index properly but if i set it to Longest it changes to -1 for the index i dont want and 0 for indexes i do want but it doesnt give me the indexes

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/2/b28f8dd446914a6a3601e15e949e7c9f5abeb011.png)
