How to know the item number in a DynamicList

How to know the item number in a Dynamic List.

I have something or need to use the Counter API ?
If it’s necessary the Counter API can I have a sample.

Thanks, Mario

I am sorry but I do not understand this question. Could you ask with an example maybe?

Print it out with Print block (in Text category).

OK, this is a Dynamic List of items:

When you press “Listado Switches” download from a service the list of 3 light switches.

Screen Shot 2021-10-30 at 13.33.11

At the codeless side I need to send the item number = “ID” to the API. At the sample is #2 (number two) fixed but should be the number 3 of the list (equals 0, 1, 2).

I need to replace Screen Shot 2021-10-30 at 13.35.37

with something represent the variable of the cell I’m clicking any of this function buttons:

Thanks, Mario

  1. How is the dynamic list configured in the UI? is it a block or container?
  2. What’s inside of that dynamic list on the UI side?
  1. Container with only one cell.

  1. 3 Buttons and an Object with the list of switches (name, and other info not necessary), not ID there.

When you get the light switches from a service, iterate over the collection and assign ID to each light switch. Then in the onClick event of your button, you will get something that looks like this (it will have the name of your container):
UI Builder - ConsoleDemo - Backendless 2021-10-30 13-35-17

That block will contain the property and value which you assigned when you iterated over the results of service.

Yes perfect but I need the number of the ID of the collection. The position numer 0 or 1 or 2 just the number can I find it?

Are you saying when you get the results from the service, each item already has an id?

I need the id, yes because that info is not at the array. How can I know? What id the user is selecting?

If the response from service does not include id for every switch, you need to assign IDs yourself. How to do it, I described here: How to know the item number in a DynamicList - #7 by mark-piller

OK, good idea I will make a loop asking for some data to compare with an ID counting +1 starting from 0 ! Thanks!