How to retrieve an element index in a dataview array?

Things I have tried

What I’m trying to do

Is there a function in dataview that gives the index value of a particular element in an array?

For example: test:: one, two, three. some_function(test, “two”) = 1

In the documentation I found a way to retrieve an element based on the index: test[1] = two, but not the other way around.

Any tips are appreciated, thanks in advance.

If you don’t mind using DataViewJS, you can use the built-in JavaScript indexOf() method:

2 Likes

I haven’t used dataviewjs so far but it seems like this is the only solution, thank you for your help, this does what I was looking for.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.