Hi!
This issue regards HTML when designing a marketing email.
I am trying to get a startdate from an entity called "Membership" by using an #each loop.
I prefer c# but sometimes these tasks appear as well. What I would've done in c# is basically like this (code not tested):
DateTime startDate = new DateTime();
DateTime endDate = new DateTime();
foreach(var membership in memberships)
{
if(membership.startdate > startDate)
{
startDate = membership.startDate;
endDate = membership.endDate;
}
}And then print out the variables.
Doing the same in html doesn't seem to be as easy.
Below code is insufficient, and I don't know how to use variables like this.
var startDate = ?;
var endDate = ?;
{{#each contact.membership_id}}
{{#if (gt this.startDate startDate)}}
startDate = this.startDate;
endDate = this.endDate;
{{/if}}
{{/each}}
Member from:{startDate}
Member to:{endDate}
Please help me understand if and how this is do-able.
Another thought I had was to make a list with all the startdates and enddates (a list<datetime, datetime>-ish) and then choose the max datetime among all entries. But I have no clue on how to do this either.
Best regards,
Matilda