How to set text dynamically based on a value

Actions & Logic
Resolved

I have a bit of a weird challenge, I'm trying to set the value of a text field conditionally based on the value of document property.

My app has a 'Location Details' page, where I show the location's name, description, etc. I would also like to be able to show the 'Location Type' in a text field on that page. The problem is that the 'Location Type' strings don't match how I need them to look on the screen.

Here's my list of location types. On the left you'll see the location type, and on the right you'll see how I need it to appear in the user interface:
- ACCESS_POINTS: "Access Point"
- POI: "Point of Interest"
- TRAIL_HEAD: "Trail Head"
- RAPID: "Rapid"
- HAZARD: "Hazard"
- BRIDGE: "Bridge"

The location types need to be in this format because we're using them within custom code, so I can't just change the string of the location type to solve this problem. I need to be able to convert the location type into a corresponding string that is appropriate to include in the UI.

What have you tried so far?

I tried utilizing the 'conditional' functionality in FlutterFlow, but wasn't able to make it work. The idea was to create a system that worked like "If location type = ACCESS_POINT, then "Access Point". Seemed like it should be possible to do, but every way I tried to set it up I was unable to grab the document property 'type' to use as the variable in the IF field. I can only access the Reference, Parent Reference, or Document Exists options (everything else is disabled).

Here's a photo to illustrate what I ran into:

Did you check FlutterFlow's Documentation for this topic?
No
1
2 replies