Is there a way to add a while loop into a template

Hi,

I have a template which looks like this:
Dear [Member Name]
Thank you for using this services.
You have borrowed the following item(s) on [Loan Date]:
[Title]([Item Number])
The due date to return item(s) is [Due Date]
Thank you
(This email is sent out by RPA Robot)

The problem occurs when I need to add in the title as sometimes it would be dynamic. For example, it would be 2 [Title] that needs to be added or 1 [Title] that needs to be added.

Thank you

Hi @TOBIAS_TOH_TENG_KIAT

How about preprocess the data before adding into template?
What I mean is for example you have multiple titles, you could concatenate the titles before adding into [Title]. Separate the titles with comma or newline.

Hi @TOBIAS_TOH_TENG_KIAT ,

@otico suggestion is good. I would like to expand on the idea of preprocessing the data.

Have three sub-templates and two Excel sheets or DataTable/DataRow already filtered:

First sub-template:
Dear [Member Name]
Thank you for using this services.
You have borrowed the following item(s) on [Loan Date]:

Second sub-template:
The due date to return item(s) is [Due Date]

Third sub-template:
Thank you
(This email is sent out by RPA Robot)

First Excel sheet or DataTable/DataRow:
[Member Name],[Loan Date]
Note: You need to loop through all the records for each member name, or extract only the relevant columns

Second Excel sheet or DataTable/DataRow:
[Title]([Item Number])[Due Date]
[Title]([Item Number])[Due Date]
[Title]([Item Number])[Due Date]
Note: If you have a DataTable/DataRow, you may need to filter the [Title]s based on the [Member Name] and any other relevant criteria to get the correct match

After you have update the sub-templates with the correct values, you can concatenate the sub-templates into the correct order for the notification message.