Reputation: 211
Question:
I store my Date value in list using code below.
if (document1.hasItem("NotifyDate")){
var nd = document1.getItemValue("NotifyDate");
nd.addElement(session.createDateTime(@Now()));
document1.setValue("NotifyDate", nd);
}else{
document1.setValue("NotifyDate", session.createDateTime(@Now()));
}
I want to retrieve it to display in webpage everytime i append an item.
I18n.toString(document1.getItemValue("NotifyDate").lastElement().toJavaDate(), "dd/MM/yyyy") +")"
Problem :
Upvotes: 0
Views: 93
Reputation: 146
Just use loop to create output string.
var result="Status notification ( ";
for(var i=0; i<document1.getItemValue("NotifyDate").length;i++){
result+= I18n.toString(document1.getItemValue("NotifyDate").get(i).toJavaDate(), "dd/MM/yyyy") +" "
}
result+=")"
return result
Upvotes: 1
Reputation: 21709
You can use a repeat to list each value from the date field. Here's an example:
<xp:repeat value="#{document1.NotifyDate}" var="singleDate" removeRepeat="true">
I18n.toString(singleDate.toJavaDate(), "dd/MM/yyyy")
</xp:repeat>
Upvotes: 0