<root>
<row>
<TrainingName>Data Security</TrainingName>
<AssignedDate>2020-05-01</AssignedDate>
<DueDate>2020-07-01</DueDate>
</row>
<row>
<TrainingName>Ethics and Compliance</TrainingName>
<AssignedDate>2020-05-01</AssignedDate>
<DueDate>2020-09-01</DueDate>
</row>
<row>
<TrainingName>Onboaring</TrainingName>
<AssignedDate>2020-05-01</AssignedDate>
<DueDate>2020-08-01</DueDate>
</row>
</root>
<root>
<row>
<MailData>Data Security, 2020-05-01, 2020-09-01|Onboarding, 2020-05-01, 2020-08-01</MailData>
</row>
</root>
def void MailData (String [] TrainingName,String [] AssignedDate, String [] DueDate, String[] CurrDate, Output output, MappingContext context){
String pattern = "yyyy-MM-dd"
def Curr_Date = new SimpleDateFormat(pattern).parse(CurrDate[0]);
String Ans = "";
for (i=0;i<DueDate.size();i++){
def Due_Date = new SimpleDateFormat(pattern).parse(DueDate[i]);
if (Due_Date < Curr_Date){
Ans = Ans + TrainingName[i] + "," + AssignedDate[i] + "," + DueDate[i] + "|"
}
}
output.addValue(Ans);
}
def Message FormatEmailData(Message message)
{
def map = message.getProperties();
def MailData = map.get("MailData");
int count = 0;
String breaks = "";
String MailDATA = '<table width="80%" border="1" align="left" border-collapse="collapse"><tr><th align="left" bgcolor="#add8e6">Training Name</th><th align="left" bgcolor="#add8e6" >Assigned Date</th><th align="left" bgcolor="#add8e6">Due Date</th></tr>'
for(i=0;i<MailData.length();i++){
if (MailData.charAt(i) == "|"){
count++;
}
}
for (j=1;j<=count;j++){
String main = MailData.substring(0,MailData.indexOf('|'));
String[] Main = main.split(',');
String TrainingName = Main[0];
String AssignedDate = Main[1];
String DueDate = Main[2];
MailDATA = MailDATA + "<tr><td>" + TrainingName + "</td><td>" + AssignedDate + "</td><td>" + DueDate + "</td></tr>"
if (j != count){
MailData = MailData.substring(MailData.indexOf('|') + 1);
}
}
for(k=1;k<=count*2;k++){
breaks = breaks + '<br></br>';
}
MailDATA = MailDATA + "</table>" + breaks;
message.setProperty("MailData",MailDATA);
return message;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |