# Iterator Index Querying is not working

**URL:** <https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, array-methods, iterator-index-querying\
**Created:** [June 8, 2016, 6:23am UTC](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911 "2016-06-08T06:23:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reuben](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/reuben/32/1409_2.png) [@Reuben](https://verificationacademy.com/forums/u/Reuben)\
**Post date:** [June 8, 2016, 6:23am UTC](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911/1 "2016-06-08T06:23:56Z")

</div>

I’m trying to see how the iterator index querying for arrays but when I compile it flags an error.

```verilog

int arr[];
int qi[$];

initial begin
  arr = {.....};

  qi = arr.find with (item == item.index); // Error is pointing at index. It says hierarchical name component lookup failed
end

```

I’m using Cadence Incisive version 14.10-s032.

Is this a bug on the System Verilog language, or is it just I’m not doing it correctly?

Thanks.

Regards,  
Reuben

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [June 9, 2016, 3:24am UTC](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911/2 "2016-06-09T03:24:07Z")

</div>

_In reply to [Reuben](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911):_  
You need to use parenthesis () instead of braces {}.

---

<div class="post-metadata">

**Author:** ![Reuben](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/reuben/32/1409_2.png) [@Reuben](https://verificationacademy.com/forums/u/Reuben)\
**Post date:** [June 9, 2016, 3:39am UTC](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911/3 "2016-06-09T03:39:30Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911/2):_

> _In reply to [Reuben](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911/2):_  
> You need to use parenthesis () instead of braces {}.

Hi Dave,

Sorry I mistakenly used braces instead of a parenthesis. That code above is actually a parenthesis. The one that is failing on my side actually uses a parenthesis, not braces. I will edit the code above to avoid confusions on the people reading my question.

So the issue hasn’t been resolved yet. I wonder if this is a bug or something is wrong on the way I implement it.

Thanks.

Regards,  
Reuben

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [June 9, 2016, 3:41am UTC](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911/4 "2016-06-09T03:41:47Z")

</div>

_In reply to [Reuben](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911/3):_  
Works for me in Questa.

---

<div class="post-metadata">

**Author:** ![Reuben](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/reuben/32/1409_2.png) [@Reuben](https://verificationacademy.com/forums/u/Reuben)\
**Post date:** [June 9, 2016, 7:07am UTC](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911/5 "2016-06-09T07:07:46Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911/4):_

> _In reply to [Reuben](https://verificationacademy.com/forums/t/iterator-index-querying-is-not-working/31911/4):_  
> Works for me in Questa.

I see. I guess this is a tool problem.  
Thanks.

Regards,  
Reuben
