Get index of double

Hello all,

I have a small and perhaps simple question but I can’t figure it out.

I have a list of doubles whose index I want to fetch.

But the List.IndexOf node returns only -1.

Anyone any idea?

@Nick_Boyts maybe?

Thanks for contributing ideas.

Looks like you have two minor issues.

  1. Your list levels are off. You want to check the list, which is @L2, for the item.
  2. Your object types don’t match. An int won’t match with a double even if they’re the same value. Use 10.0 instead.

    Also, use AllIndicesOf if you want every instance of the item, not just the first.
2 Likes

Thanx a lot Nick!

1 Like

Hello, (double, integer) :wink:

cordially
christian.stan

Yet another question…

I want to replace the items in the list in the watch node with the values ​​from the code block based on the indexes from the List.AllIndicesOf node.

So index 0 should become k, index 1 and 3 should become k+v and index 2 then k-v.

You’ll need a custom node (Clockwork has one and I think Orchid as well) to replace multiple items at once.

Hmm, that doesn’t work either, or am I doing something wrong here?

Hello @Fernand77 …is it something here you need…

i get null

are you sure your indicies are integers???

Yes.

Pull apart the custom node and make sure everything is working as expected. You may be missing IronPython2. I would also recommend simplifying your list structure if possible.

1 Like

yeah i would do as Nick say simplify your list…or try to play around with your list levels in your custom node try @L3 in indicies…i see you are in a old clockwork version,not sure probably difference in versions,try to install the latest clockwork version and oh yeah Iron python 2 :wink:

It works almost!!

Thanx @Sovitek and @Nick!

1 Like

You request 4 replacements with 3 values
​​(you have to add a “k+v” before the “k-v”)
if you make a long combination you will have a “k-v” otherwise
[“k”,“k+v”,“k+v”,“k-v”]

cordially
christian.stan

1 Like

no that won’t work.

all items in list 0 must be replaced by k, all items in list 1 by k+v and all items in list 2 by k-v.

think Christian mean something…

yes i understand but that is not what i want.

The List.AllindicesOf will always be 3 lists on @L2, but @L1 is different every time.

Actually as I indicate in the picture with the arrows.

or is it possible to create a list based on another list?

Like in the picture below?

afbeelding

Hi @Fernand77 i am not 100 sure what you mean…probably something

1 Like