how to get a list with the value of the positions that contain a value.

Hello everyone, I need help to solve the following.

From a list with n data, how to get a list with the value of the positions that contain a value.

For example, from the following List( Pear,banana,Apple), the result I need to obtain is LIST(1,2,3)

Gracias!

 

0 9 255
9 REPLIES 9

One way you could do this is (I haven't tried it, but should work๐Ÿ˜…)

  1. Create a read only table (ie Lists) like
    IDELEMENTS
    11
    21,2
    n max number of your list size1,2,3,,,,n
  2. An expression:

 

SPLIT(
 LOOKUP(
  COUNT([Your LIST HERE]),
  "Lists",
  "ID",
  "ELEMENTS"
 ),
 ","
)

 

If you need a very long list, you can write actions to create such lists but probably it will take a long time to execute and not fit your use case, whatever that may be.

@Suvrutt_Gurjar  briefly submitted and deleted a post which I believe could be quite relevant. 

So, @Adolfo_Enrique_ , if you are looking for functionality of INDEXOF(), which AppSheet does not provide natively, you should do a search on INDEXOF and look at some of the techniques already submitted by some pioneers.

(Thanks @Suvrutt_Gurjar !)

Hi @TeeSee1 ,

Thank you.

Yes, I deleted the post because after rereading @Adolfo_Enrique_ ' s post, I thought I misunderstood  his requirement. After rereading I concluded, he is probably looking for creating a numeric list rather than finding the index of an element in a list that I responded with.

Anyway, let us await further response from @Adolfo_Enrique_ 

 

hello everyone, first of all thank you very much for your help. @Suvrutt_Gurjar , @TeeSee1 

What I need is, starting from a list with n values, to obtain a list with the position that each of the values โ€‹โ€‹occupies. I am not doing a search for a particular value, simply, if the list is for example LIST(A,B,C,X,Y,Z) , get a list with each of the positions, in the case of the example the the result will be LIST(1,2,3,4,5,6).

@Adolfo_Enrique_ 

How many elements the list is likely to have? In 10s or 100s or 1000s

Accordingly the community could suggest a most appropriate solution if available.

no more than 10 elements

Your expression for the numeric list can be something like 

LIST(LEFT(LIST(1,2,3,4,5,6,7,8,9,10), FIND(COUNT([Fruits List]), LIST(1,2,3,4,5,6,7,8,9,10))))

Assumes the [Fruits List] will never be empty. Or some more expression may need to be added to take care of empty [Fruits List].

Steve
Platinum 5
Platinum 5

Why would you want to do this?

Hello Steve.
I tell you, I need to be able to select elements from a list and then to the selected element, indicate the position in which that element will take. For example, if I have the list fruits(apples, pears, bananas), I can obtain from the list fruits, a list called posfruit(1,2,3) posfruit is obtained from the list fruits, in this way if the fruit list has 5 elements, posFruit will be posFruit(1,2,3,4,5) My idea is to have a screen with two combo boxes. one to select elements from the fruit list and another combo box to indicate in which position I am going to place the selected fruit, regardless of the position of the selected fruit.

In this way, for example, from the fruit list, I will be able to select the value apples, and from posFruit select 3. In this way I will be able to indicate the order that the fruits will occupy, regardless of the position they occupy in the fruits list.

I hope you understand what I need to do.

Top Labels in this Space