Display a List field with comma seperated data on different lines in Repeated Group

I am creating a page that draws Exercise Names and Exercise Images(gifs) from the database and displays them in a repeated group.
Both these are list fields under the data type ‘Patient’. So they are saved as comma seperated values in the database

The values appear in the same line and not as a list.

So I tried to use extract with regex to get the comma seperated data on different lines.

But the RG goes blank.

How do I get to display the data in different lines? What should be the Regex pattern?

Any help is much appreciated.


Hi @drswatilimaye :slight_smile: After the list of texts expression, you can use the “:join with” operator and then enter “line break” similar to:


1 Like

Thank you @fayewatson for your response.
The expression shows an issue with the data type- ‘Patient’ although the field- ’ Prescription Exercise Name’ is a List of texts under ‘Patients’.

How do I correct this?


@drswatilimaye Ah! My apologies – when I first looked at your screenshots, I thought that you were putting a list of texts in a text element that was within a repeating group, but now I see that you’re using a repeating group to display the list of exercises with images. That definitely works too! :slight_smile:

I think it may be easier to manage your database if you create a new data type called “Exercise”, which contains two fields:

  1. “Name” (type: text, list: no) for the exercise’s name
  2. “Image” (type: image, list: no) for the exercise’s image
    (Note: if a single Exercise can have multiple images, then it may be better to make the “Image” field an “Images” field (type: image, list: yes)).

This way, you could then ‘assign’ exercises to each Patient thing in your database, by storing it on an “Exercises” field (type: Exercise, list: yes) under the Patient data type.

Once that setup is created, your repeating group’s type would be “Exercise” and its data source would be “Current page Patient’s Exercises”.

Then, you can place an image element in the repeating group’s first cell to display the exercise name using the expression, “Current cell’s Exercise’s Name”.

To display the associated Exercise image, you could add image element with the image source set to: “Current cell’s Exercise’s Image”
(Or, if you are associating multiple images with each Exercise, you could place a second repeating group in the cell (so it becomes a ‘nested’ repeating group), of type: image, with the data source set to “Current cell’s Exercise’s Images”. Then, place an image element within the first cell of that nested repeating group, and set the data source to “Current cell’s image”. This will allow you to display multiple images associated with each exercise).

And that should do it! But please let me know if I can clarify anything, or if you have any questions at all! :slight_smile:

Thanks @fayewatson for the detailed post.

I have a data type called Exercise Bank with fields exercise name and exercise image.
Created a field- ‘Exercises’ under ‘Patients’ with exercise bank as data type.:slightly_smiling_face:
The both the fields now get assigned into the patient’s exercises as suchScreenshot%20(175)

However while I retrive the prescription, the previous issue recurs.

The exercise names get dislpayed on the same line in RG. Also the images are not visible for some reason.
Here is how the dynamic inputs look.

What am I missing here?


@drswatilimaye Awesome! :slight_smile: Since you want to dynamically display the repeating group’s data, use “Current cell’s exercise’s name” for the text element in the repeating group, and “Current cell’s exercise’s image” for the image element in the repeating group. Since your repeating group data source is set to display the Patient’s list of Exercises, you use “Current cell’s…” to display the repeating group’s data (making sure the repeating group’s data source is “Current page Patient’s Exercises”). You’re currently using the page parameter as the data for those two elements, which is why the data each repeating group cell looks the same. Changing to “Current cell’s…” should fix it!

Feel free to let me know if you have any questions! :slight_smile:

1 Like

@fayewatson You are a Rockstar!!:tada:
The logic you gave not only resolved issues on this page but also helped me sort them out on other pages.

Thanks a ton!!:smiley:
Best Wishes

1 Like

Awesome!! My pleasure, Swati!! So glad to hear that it was helpful! :relaxed:

This topic was automatically closed after 70 days. New replies are no longer allowed.