Allocate a text to integer in repeat

Hi there

I have data in repeat as follows:

repeated.current.fields.type.integerValue

It gives me 1,2,3,4,5,6 back. Nicer would be to display text instead of a number.

1 = Train
2 = Car
4 = Plane

and so on.

How would I do that?

Thanks for the help
Andreas

  1. Create a list of objects (either on front end or a data from server).
  2. Create object properties e.g. ID (your current integer) and Name (to store your names).
  3. Each element of the list should be e.g. ID: 1, Name: Car
  4. Repeat item by the list of objects
  5. Repeat option will represent each parameter
1 Like

Hi @Lukasz_Kwiatkowski

Thanks for your help. I am sadly not quite there yet.

I’ll get the data with http request from firebase as a json.

So as I understand I get your point 1 from firebase. There I find my integer. Then in Appgyver in GET COLLECTION DATA I can add an additional property to my integer as you can see here:

But then I struggle. Do I need to add to the firebase db the “name” too?

Thanks for the help
Andreas

well a workaround would be to add just additional db field with the names and save the number and name. I was just curious if it would be able to skip that and solve the thing without modifying the firebase database

hi @Andreas_Niedermann I am not sure if I am understanding where you are trying to get.

The schema you are showing looks fine. Just save it from the response then:

  • create a data variable on the screen where you want to have your list based on this connection
  • repeat an element or a container with different elements by this data variable
  • select repeated.name as one of the properties of the components that are repeated (e.g. header, paragraph)

Hi @Lukasz_Kwiatkowski thanks for your reply.

Yeah, I can assume it is confusing when talking with a non-programmer :slight_smile:

Well, in the screenshot above I added the object property “name” manually there in Appgyver. That’s nothing Firebase is returning. Firebase is only returning the “type”.

But if the easiest way is to save the name info in Firebase too I would manage to find a solution