Need an efficient and elegant way to display a text string from 3 data fields

See the matriculates below and the screen output.

Each post has 3 stored values: ItemType, PostType and PostReaction. For each post I render on the page, I want to display the correct Post User Text per my matrix.

One way to do it - which feels horrific - is to have a 27 conditions on the field that displays Post User Text. Doing that for each post in a RG feels wrong.

I was rather hoping I could do it with a single concatenated find/replace statement, but find/replace is not available for the display field.

Any suggestions for an efficient/elegant solution?

Hello @GB44,

An alternative could be to add the post user text as a 4th stored value when that post is created.

If you are rendering the text dynamically upon dynamic selections of these values during a user session, avoid as much as possible to interact with the dB. Build logic and calcs that render on the page. And then, try to save it to the dB so that for the next session the post user text renders as a default value from the dB, and gets changed as inputs are changed on the page.

This is an interesting video that could possibly spark further ideas about the functionality that you want to build by @evanlitttle > How To Create A Multi Layer Filter In Your App

Displaying and filtering are usually less performant approaches to building in my experience … but they are indeed an option nonetheless!

Hope this helps! :+1:

1 Like

Thanks for commenting!

I thought about db performance too so I’m glad you mentioned it.

I managed to get it down to 3 conditionals using find/replace, but I’m hoping I can replicate that logic upon save, per your suggestion, and save the text as a new data field for simpler rendering.

1 Like

@GB44 Great stuff! :+1: