This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Patrick Hansen
Posted Mar 16 - Read on Facebook

Does anyone know how to get the current index position of a layer within an array based on a property value - something like this:
for listItem in myList
if == "foo"
return listItem.currentIndex


Seoh Char

like this?

Patrick Hansen

Seoh Char thanks for the response. I guess I should have been a bit more detailed. What if the layer has multiple properties like this:

list = [
{“name”:”A”, “label”:”apple”}
{“name”:”B”, “label”:”banana”}
{“name”:”C”, “label”:”cucumber”}
{“name”:”D”, “label”:”date”}

the return value of the entire property set instead of just the index number:

print i
» {“name”:”C”, “label”:”cucumber”}

and I want just the index number like this

print i
» 3

Koen Bok

Behold the power of coffeescript:

(notice the "of" keyword in the loop)

Patrick Hansen

Koen Bok that's it! Thank you for your help and quick response.

Chris Camargo

I was about to ask the same question in a different context. <3 this community.

Read the entire post on Facebook