Get the reverse order from array

Hello,
I need a function that gives me the reverse order from the objects that are in the array. I tried to create 2 arrays but it didn’t work in TULIP. Maybe you can help me.

hello @katha, that’s a great question!!

there are many ways to build this in Tulip, the best solution really depends on how the rest of your app is set up. one solution i’d like to suggest is:

  1. get the length of the array and store it in a Variable (index in this example)
  2. use the Get Array from Index function & subtract one from the index until you get to the start of your Array

this would result in something similar to:

is this helpful for what you’re trying to build?? let me know if I can provide more information on this solution.

gio

thank you @gio,
this would be a good solution, but I need the function contemporary to the “push” onto array and can’t press for every step a button. So can I get a data from the bottom of an array with the Get from index in Array or for what is this function? Thank you

hello @katha, the Get from Index in Array requires this index that indicates the position of the element you’d like to extract from the Array.

to get the data from the bottom of an Array, you can use the Pop from Array (gets the last item in an array) and Push to Array to add it to your new, reverse, array. here is how this would work (this does still require you to click the button for each element in the Array):

would you like to join Office Hours so we can further discuss in detail how to build what you’re trying to achieve?? Office Hours are held weekly on Thursday at 11AM EST, the next one being 2020-11-05T16:00:00Z2020-11-05T17:00:00Z. let me know if you’d like to join that and I can add you to the invite!!

gio