Show dynamic content (several grids/lists) with titles based on a picker


#1

I am trying to figure out how to get exactly what I have in mind and I don’t get to achieve it, although I am sure it can be done because I believe it is not too complicated but maybe I have to approach it some other way.

I have right now a screen that shows several grids/lists based on a picker which filter the datasheets that have to be shown. I want to have a “title” for each one of those lists, but the text of that title would be also dynamic and that is what I don’t how to get.

By the way, the database is in Firestore and the structure for these lists is similar to:

\main (collection)
       \pickerValue1 (document)
             \title1 (collection)
             \title2 (collection)
             \title3 (collection)
       \pickerValue2 (document)
             \title1 (collection)
             \title2 (collection)
             ...

I have noticed that for the “titles” collection I can add information fields like in any other document, which would allowed me to specify the text that want to be displayed for that specific grid/list, but I don’t get to figure out how to put that text over the list like a title would do it.

Thank you!


#2

Hi, I don’t think there are any other way than to change the Title value based on the Picker selection. So I’m guessing the picker stores the collection value to Data slot? Then just create script for title element which changes the text value based on what reads in Data slot.

Something like this:

switch( dataslotvalue ) {
case ‘x’ :
return ‘Title 1’;
break;
case ‘y’ :
return ‘Title 2’;
break;
default:
return ‘Title 123’;
}


#3

Well. I have been trying different things and I saw I was creating too many documents and collections within other collections so I decided to simplify my database and use the query options to get the items I need based on the picker.

So right now all of the documents are within the same collection and the picker filter the result of the documents that are retrieved. Now I would like a title that would change based on the value selected in the picker.


#4

In that case the script approach I suggested should do the trick.


#5

I had some issues but I was able to solve it so I edited this post. Thank you!