ignore duplicates in for each

ignore duplicates in for each

Hi,
I am using the following programme to return values (Bin Numbers) and dates that have been used in the report.
a = Collections[Bin_Number != "" && Site_Name.Customer_No == "WXH" && Date_Time > zoho.currentdate.subMonth(1)];
b = Master_Bin_List[Bin_Number not in a.Bin_Number.getall() && Site_Name.Customer_No == "WXH" && Ignore_in_count1 != "yes"].Bin_Number.getAll();
c = Collections[Bin_Number in b] sort by Date_Time desc;
d = Master_Bin_List[Bin_Number not in c.Bin_Number.getall() && Bin_Number in b];
e = d.Bin_Number.getall();
info d.count();
info c.count();
scrip = "<table>";
for each  x in c
{
scrip = scrip + x.Date_Time + "-" + x.Bin_Number + "<tr>_";
}
for each  y in d
{
scrip = scrip + y.Bin_Number + " = null <tr>_";
}
C = scrip + "</table>";
return C;

So as seen i return dates and bins from a master bin list in the collections form where the bins are seen.

what i am trying to do is return the last seen bin.

i.e. 1/1/2020 is the date last seen.

I only want to return that date. Not the others before it.

I was thinking of running a count function but didnt think it would work or would be a clunky method.

Do you guys have any ideas?