AnsweredAssumed Answered

using loop inside gel:email

Question asked by mona86 on May 15, 2013
Latest reply on May 17, 2013 by Dave

( sorry if it is too long ).
I would like to create a process whihc sends an email to all managers belonging to different OBS units in IT Department containing the list of resources who have not completed their timesheet + the related time periods.

First, I wrote a query to select all the managers that I needed and the result is stored in var= "result3".
Then I wrote this:
<core:forEach items="${result3.rowsByIndex}" trim="true" var="mng">

<core:set value="${mng[0]}" var="userid"/>

<core:set value="${mng[1]}" var="ManagerLastName"/>

<core:set value="${mng[2]}" var="ManagerFirstName"/>

<core:set value="${mng[3]}" var="ManagerEmail"/>

<core:set value="${mng[4]}" var="idManager"/>

<gel:log> manager ${mng[1]} </gel:log>

Next I selected all the resources who did not compile their timesheet and the result is stored in result2.
and this is the last part:
<core:forEach items="${result2.rowsByIndex}" trim="true" var="tms">

<core:set value="${tms[0]}" var="id_risorse"/>

<core:set value="${tms[1]}" var="Full_Name"/>

<core:set value="${tms[2]}" var="Email"/>

<core:set value="${tms[3]}" var="Time_Period"/>

<core:set value="${tms[4]}" var="Prid"/>

<core:set value="${tms[5]}" var="MANAGER_ID"/>

<gel:log> Risorsa: ${tms[1]} periodo: "${tms[3]}"</gel:log>

<gel:email from=""

subject="MISSING TIMESHEET: ${tms[3]}"

( Here is the CONTENT OF EMAIL: Here is the list of resources who .......
Resource: ${tms[1]}, id= "${tms[0]}"





Here, the problem is that in this way, each manager receives lot of email related to each resource or each time period, while each manager must receive ONLY 1 email containing the LIST OF RESOURCES ...

I tried also putting the last two </core:forEach> after <gel:log.. and before <gel:email.... , in this way each manager receives ONLY 1 email, but the problem is that now Resource: ${tms[1]}, refer to the last resource only.
I do not know how can I refer to the list of resources inside <gel:email....

I do appreciate if someone knows if it is possible to refer to the list of resources inside gel:email and how? or if I could write a loop inside a gel:email.

any answer or idea is highly appreciated.

Manhy thanks,