Get an array element at a specific index using a variable
Options
![Stephen Smith](https://us.v-cdn.net/6037124/user_avatars/2826800.jpg)
Stephen Smith
Member ✭
I have an array...
myArray = ["a","b","c"].
I then have a variable...
myValue = 2
How can I create a new variable which is the element at the position of myValue? So myNewVariable = "c".
I have tried creating a new variable, setting the value to that of the array, then using get with a path of myValue, but I am unable to make it work. Any help would be greatly appreciated.
myArray = ["a","b","c"].
I then have a variable...
myValue = 2
How can I create a new variable which is the element at the position of myValue? So myNewVariable = "c".
I have tried creating a new variable, setting the value to that of the array, then using get with a path of myValue, but I am unable to make it work. Any help would be greatly appreciated.
Comments
-
Use the GET filter, to get the value of the array with myValue:
https://docs.xano.com/working-with-data/dot-notation#get-filter
[CleanShot 2022-01-14 at 11.36.06.png] -
Thank you so much for the response. That worked great!
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback