Apending text to a text field in the Backend

Hi All, This one has stumped me, any suggestions would be great.

To elaborate, I have a Survey form with several fields text fields

  1. Question 1
  2. Response 1
  3. Question 2
  4. Response 2

In the workflow, each value is combined and saved into another text field in the DB. Pretty straight forward so far.

However, one of the requirements is to omit some fields based on its value. i.e. When Response 2 is empty, then exclude Question 2 and Response 2 from the combined test field.

My solution currently uses conditionals, but it doesn’t scale with increasing no. of questions in the survey. A way to append data to the end of a text field in the backend would be ideal but I haven’t come across a way to do this.

I think you can do this in the front end. I am guessing you will eventually use a repeating group to display each question and next to that, there will be a text input for the response?
See the demo below:

Technically, you can create a custom state to the repeating group of type list of texts (actually this custom state can be anywhere, not necessarily in the repeating group). And you will add to this list, the combined value of the question+response whenever the input value has changed. If there is a text in the response, add the combination to the custom state. If not, remove from the custom state by filtering out.

Here is the workflow for when there is a response text: (I named the custom state Answered Q&Rs.

And where there is not:

I decided to print the custom state to a text field on the right as you see, but you can do anything with that:

Here is the bubble app if you want to check the details.

Excellent solution for the frontend. I’m limited to doing this in the backend. Any suggestions?