FTSearch involving date fields is confusing me - lotus-notes

I have Custom Control with a search screen that lets the users select any of up to six different fields to search on. I had no trouble getting all the other fields working with the exception of the two date fields. They can fill in both begin and end dates or just one or the other. Pretty standard stuff but I cannot figure out how to write the code to make the query work and have it do the search when it involves dates.
var tmpArray = new Array("");
var cTerms = 0;
if(requestScope.cmbSendTo != null & requestScope.cmbSendTo != "") {
a = #Right(requestScope.cmbSendTo, "(");
b = #Left(a,3);
tmpArray[cTerms++] = "(FIELD Mnemonic = \"" + b + "\")";
}
if(requestScope.edtFrom != & requestScope.edtFrom != "") {
tmpArray[cTerms++] = "(FIELD From = \"" + requestScope.edtFrom + "\")";
}
//**************************************************************************
if(requestScope.edtDateRangeFrom != null & requestScope.edtDateRangeFrom != "") {
tmpArray[cTerms++] = "(FIELD DeliveredDate >= \"" + requestScope.edtDateRangeFrom + "\")";
}
if(requestScope.edtDateRangeTo != null & requestScope.edtDateRangeTo != "") {
tmpArray[cTerms++] = "(FIELD DeliveredDate <= \"" + requestScope.edtDateRangeTo + "\")";
}
//**************************************************************************
if(requestScope.edtOriginal != null & requestScope.edtOriginal != "") {
tmpArray[cTerms++] = "(FIELD SourceFilename = \"" + requestScope.edtOriginal + "\")";
}
if(requestScope.edtCaptiva != null & requestScope.edtCaptiva != "") {
tmpArray[cTerms++] = "(FIELD Filename = \"" + requestScope.edtCaptiva + "\")";
}
qstring = tmpArray.join(" AND ").trim();
requestScope.queryString = qstring;
return qstring
Any assistance would be appreciated
The idea behind this screen was taken from this video:
XPages View Control - Add Full Text Search - http://www-10.lotus.com/ldd/ddwiki.nsf/dx/XPagesViewControlAddFullTextSearch.htm

The line if(requestScope.edtFrom != & requestScope.edtFrom != "") { is not complete. You miss the part to test for. I assume it lacks the null check and therefore should be:
if(requestScope.edtFrom != null & requestScope.edtFrom != "") {
Furthermore, you need to format the date to return what you expect for the query (e.g. MM/dd/yyyy). The formatting in the inputText control only applies to the visual formatting and not the format of the actual content.
Finally, you need to remove the quotes around the date.
The following code example based on your code will return the date without formatting and then return the date with the correct formatting:
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="computedField1"></xp:eventHandler>
</xp:button>
<xp:inputText id="edtDateRangeFrom" value="#{requestScope.edtDateRangeFrom}">
<xp:this.converter>
<xp:convertDateTime type="date"></xp:convertDateTime>
</xp:this.converter>
<xp:dateTimeHelper></xp:dateTimeHelper>
</xp:inputText>
<xp:text escape="true" id="computedField1">
<xp:this.value><![CDATA[#{javascript:var tmpArray = new Array("");
var cTerms = 0;
if(requestScope.edtDateRangeFrom != null & requestScope.edtDateRangeFrom != "") {
tmpArray[cTerms++] = "(FIELD DeliveredDate >= \"" + requestScope.edtDateRangeFrom + "\")";
var dateFormatter = new java.text.SimpleDateFormat( "MM/dd/yyyy" );
var formattedDate = dateFormatter.format( requestScope.edtDateRangeFrom );
tmpArray[cTerms++] = "(FIELD DeliveredDate >= " + formattedDate + ")";
}
qstring = tmpArray.join(" AND ").trim();
requestScope.queryString = qstring;
return qstring}]]>
</xp:this.value>
</xp:text>
It will return the following where the 2nd part is the format you are looking for:
(FIELD DeliveredDate >= "Fri Apr 27 12:00:00 CEST 2012")
AND (FIELD DeliveredDate >= 04/27/2012)
Here is your code with all these updates:
var tmpArray = new Array("");
var cTerms = 0;
var dateFormatter = new java.text.SimpleDateFormat( "MM/dd/yyyy" );
var formattedDate = "";
if(requestScope.cmbSendTo != null & requestScope.cmbSendTo != "") {
a = #Right(requestScope.cmbSendTo, "(");
b = #Left(a,3);
tmpArray[cTerms++] = "(FIELD Mnemonic = \"" + b + "\")";
}
if(requestScope.edtFrom != null & requestScope.edtFrom != "") {
tmpArray[cTerms++] = "(FIELD From = \"" + requestScope.edtFrom + "\")";
}
if(requestScope.edtDateRangeFrom != null & requestScope.edtDateRangeFrom != "") {
formattedDate = dateFormatter.format( requestScope.edtDateRangeFrom );
tmpArray[cTerms++] = "(FIELD DeliveredDate >= " + formattedDate + ")";
}
if(requestScope.edtDateRangeTo != null & requestScope.edtDateRangeTo != "") {
formattedDate = dateFormatter.format( requestScope.edtDateRangeTo );
tmpArray[cTerms++] = "(FIELD DeliveredDate <= " + formattedDate + ")";
}
if(requestScope.edtOriginal != null & requestScope.edtOriginal != "") {
tmpArray[cTerms++] = "(FIELD SourceFilename = \"" + requestScope.edtOriginal + "\")";
}
if(requestScope.edtCaptiva != null & requestScope.edtCaptiva != "") {
tmpArray[cTerms++] = "(FIELD Filename = \"" + requestScope.edtCaptiva + "\")";
}
qstring = tmpArray.join(" AND ").trim();
requestScope.queryString = qstring; // this just displays the query
return qstring // this is what sets the search property

If I'm reading it right, your query is resolving to
FIELD DeliveredDate >= "xx/yy/zz"
My first instinct was that you needed this instead:
FIELD DeliveredDate >= [xx/yy/zz]
But documentation indicates that you don't need brackets or quotes, so this:
FIELD DeliveredDate >= xx/yy/zz

Double check the query being created here. Perhaps print it to the screen or grab it from the debugger. You may see a problem there within the query and I believe you should be able to take that exact query and paste it in the search window of the database that has been full text indexed.
Also, have a look at this doc which covers notes query syntax, it may help you troubleshoot. I didn't see anything wrong in your code though.
http://www.loganmachinists.com/help/help8_client.nsf/f4b82fbb75e942a6852566ac0037f284/0e044d2c0639c979852572fe00687f29?OpenDocument

dates should always ( in my experience ) be written in the format mm/dd/yyyy so for instance
[deliverdatemin] >= 1/1/2012 and [deliverdatemax] <= 1/30/2012
An easy way to find out which query you are generating is to use the following piece of code to throw an error with the query generated
//youre own code
throw new java.lang.exception(queryvariable);
Or you could simply do a print() to display the query on the serverconsole

As of my concern The best way to handle the date field is that converting our date value for one specific format using NotesDateTime., Because this is the best date conversion for xpage.
Dim dateTime As New NotesDateTime( "date String" )
or
Dim dateTime As New NotesDateTime( NotedateTime.getDtaeOnly() )

Related

Tabulator formatting negative money using accounting principles

Love this tool. But using the built-in formatters I can't figure out how to format money when negative with parentheses around it instead of the negative character.
so like (1000) and not -1000
If I need to do something custom I can work with that too.
moneyParen: function money(cell, formatterParams, onRendered) {
var floatVal = parseFloat(cell.getValue()),
number,
integer,
decimal,
rgx;
var decimalSym = formatterParams.decimal || ".";
var thousandSym = formatterParams.thousand || ",";
var symbol = formatterParams.symbol || "";
var after = !!formatterParams.symbolAfter;
var precision = typeof formatterParams.precision !== "undefined" ? formatterParams.precision : 2;
if (isNaN(floatVal)) {
return this.emptyToSpace(this.sanitizeHTML(cell.getValue()));
}
number = precision !== false ? floatVal.toFixed(precision) : floatVal;
number = String(number).split(".");
integer = number[0];
decimal = number.length > 1 ? decimalSym + number[1] : "";
var isNeg = (integer.includes("-"));
if (isNeg === true) { integer = integer.replace("-", ""); }
rgx = /(\d+)(\d{3})/;
while (rgx.test(integer)) {
integer = integer.replace(rgx, "$1" + thousandSym + "$2");
}
var retPt1 = after ? integer + decimal + symbol : symbol + integer + decimal;
return isNeg ? "(" + retPt1 + ")" : retPt1;
},
Thanks, this was very helpful. FYI, you might want to change the last line of the function to keep right justification alignment of positive and negative numbers:
return isNeg ? "(" + retPt1 + ")" : retPt1 + " ";

Update drop down list dynamically - xpages

I have a form with two drop down type ahead fields. The first one works but the second one has to use different views based upon the input of the first value (actually a viewScope variable stored after the first is input). The second drop down is empty no matter what is typed into the first one. I will include the code I have for the selectItems for the second field below. I also will include the visible code to only display the second field for certain circumstances. Can you please take a look at what I have? Thanks for your help. (the views in the code are all data sources)
switch(viewScope.vsTieIn) {
case "0046":
return viewAceLkup.getColumnValues(0) + viewAceLkup.getColumnValues(1) + viewAceLkup.getColumnValues(2) + "|" + viewAceLkup.getColumnValues(0);
break;
case "0009":
return viewDIBLkup.getColumnValues(0) + viewDIBLkup.getColumnValues(1) + viewDIBLkup.getColumnValues(2) + "|" + viewDIBLkup.getColumnValues(0);
break;
case "0166":
return viewOrgillLkup.getColumnValues(0) + viewOrgillLkup.getColumnValues(1) + viewOrgillLkup.getColumnValues(2) + "|" + viewOrgillLkup.getColumnValues(0);
break;
case "0016":
return viewPPGLkup.getColumnValues(0) + viewPPGLkup.getColumnValues(1) + viewPPGLkup.getColumnValues(2) + "|" + viewPPGLkup.getColumnValues(0);
break;
case "0005":
return viewTrueValueLkup.getColumnValues(0) + viewTrueValueLkup.getColumnValues(1) + viewTrueValueLkup.getColumnValues(2) + "|" + viewTrueValueLkup.getColumnValues(0);
break;
case "0026":
return viewAllProLkup.getColumnValues(0) + viewAllProLkup.getColumnValues(1) + viewAllProLkup.getColumnValues(2) + "|" + viewAllProLkup.getColumnValues(0);
break;
}
VISIBLE CODE:
getComponent("DropShip").getValue() ||
viewScope.vsTieIn == "0046" ||
viewScope.vsTieIn == "0009" ||
viewScope.vsTieIn == "0166" ||
viewScope.vsTieIn == "0016" ||
viewScope.vsTieIn == "0005" ||
viewScope.vsTieIn == "0026";
Here is the xsp code:
<xe:djFilteringSelect
id="djFilteringSelect1"
value="#{document1.CustInput}"
ignoreCase="true"
promptMessage="Enter a Customer ID, Phone or Name"
invalidMessage="Invalid Entry - check spelling"
style="width:150px"
autoComplete="true">
<xe:this.rendered><![CDATA[#{javascript:getComponent("DropShip").getValue() ||
viewScope.vsTieIn == "0046" ||
viewScope.vsTieIn == "0009" ||
viewScope.vsTieIn == "0166" ||
viewScope.vsTieIn == "0016" ||
viewScope.vsTieIn == "0005" ||
viewScope.vsTieIn == "0026";}]]></xe:this.rendered>
<xp:selectItem
itemLabel=""
id="selectItem2">
</xp:selectItem>
<xp:selectItems id="selectItems1">
<xp:this.value><![CDATA[#{javascript:switch(viewScope.vsTieIn) {
case "0046":
return viewAceLkup.getColumnValues(0) + viewAceLkup.getColumnValues(1) + viewAceLkup.getColumnValues(2) + "|" + viewAceLkup.getColumnValues(0);
break;
case "0009":
return viewDIBLkup.getColumnValues(0) + viewDIBLkup.getColumnValues(1) + viewDIBLkup.getColumnValues(2) + "|" + viewDIBLkup.getColumnValues(0);
break;
case "0166":
return viewOrgillLkup.getColumnValues(0) + viewOrgillLkup.getColumnValues(1) + viewOrgillLkup.getColumnValues(2) + "|" + viewOrgillLkup.getColumnValues(0);
break;
case "0016":
return viewPPGLkup.getColumnValues(0) + viewPPGLkup.getColumnValues(1) + viewPPGLkup.getColumnValues(2) + "|" + viewPPGLkup.getColumnValues(0);
break;
case "0005":
return viewTrueValueLkup.getColumnValues(0) + viewTrueValueLkup.getColumnValues(1) + viewTrueValueLkup.getColumnValues(2) + "|" + viewTrueValueLkup.getColumnValues(0);
break;
case "0026":
return viewAllProLkup.getColumnValues(0) + viewAllProLkup.getColumnValues(1) + viewAllProLkup.getColumnValues(2) + "|" + viewAllProLkup.getColumnValues(0);
break;
}
}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler
event="onChange"
submit="true"
refreshMode="partial"
id="eventHandler10" refreshId="custTable">
<xe:this.action><![CDATA[#{javascript:var compID = getComponent("djFilteringSelect1").getValue();
var custDoc:NotesDocument = viewCustByID.getDocumentByKey(compID);
//Set Billing Info
document1.setValue("BillCompID", custDoc.getItemValue("CustID"));
viewScope.vsBillCompID = custDoc.getItemValue("CustID");
viewScope.vsBillFax = custDoc.getItemValue("CustFax");
//Set Shipping Info
document1.setValue("ShipCompName", custDoc.getItemValue("CustShipName"));
document1.setValue("ShipAddr1", custDoc.getItemValue("CustShipAddr1"));
document1.setValue("ShipAddr2", custDoc.getItemValue("CustShipAddr2"));
document1.setValue("ShipAddr3", custDoc.getItemValue("CustShipAddr3"));
document1.setValue("ShipCity", custDoc.getItemValue("CustShipCity"));
document1.setValue("ShipState", custDoc.getItemValue("CustShipState"));
document1.setValue("ShipZip", custDoc.getItemValue("CustShipZip"));
document1.setValue("ShipProv", custDoc.getItemValue("CustShipProv"));
document1.setValue("ShipCountry", custDoc.getItemValue("CustShipCntry"));
var a = custDoc.getItemValue("CustBillName");
var b = custDoc.getItemValue("CustBillAddr1");
var c = custDoc.getItemValue("CustBillAddr2");
var d = custDoc.getItemValue("CustBillAddr3");
var e = custDoc.getItemValue("CustBillCity");
var f = custDoc.getItemValue("CustBillState");
var g = custDoc.getItemValue("CustBillZip");
var h = custDoc.getItemValue("CustBillProv");
var i = custDoc.getItemValue("CustBillCntry");
var j = custDoc.getItemValue("CustPhone");
viewScope.a = custDoc.getItemValueString("CustBillName");
viewScope.b = custDoc.getItemValueString("CustBillAddr1");
viewScope.c = custDoc.getItemValueString("CustBillAddr2");
viewScope.d = custDoc.getItemValueString("CustBillAddr3");
viewScope.e = custDoc.getItemValueString("CustBillCity");
viewScope.f = custDoc.getItemValueString("CustBillState");
viewScope.g = custDoc.getItemValueString("CustBillZip");
viewScope.h = custDoc.getItemValueString("CustBillProv");
viewScope.i = custDoc.getItemValueString("CustBillCntry");
viewScope.j = custDoc.getItemValueString("CustPhone");
document1.setValue("BillCompInfo", a + "<br />" + b + (c ? "<br />" + c : "") + (d ? "<br />" + d : "") + "<br />" + e + ", " + f + g + (h ? "<br />" + h + " " : "") + (i ? ", " + i : "") + (j ? "<br />" + j : ""));
document1.setValue("OrderStatus", "Draft");
viewScope.vsTerms = custDoc.getItemValue("CustTerms");
viewScope.vsDiscCode = custDoc.getItemValue("CustDiscCode");
viewScope.vsTradeDisc = custDoc.getItemValue("CustTradeDisc");
viewScope.vsTieIn = custDoc.getItemValue("CustTieIn");
viewScope.vsPromoCode = custDoc.getItemValue("CustPromoGroup");
viewScope.vsPromoBypass = custDoc.getItemValue("CustPromoBypass");
document1.setValue("djFilteringSelect1", "");
getComponent("djFilteringSelect1").setValue("");
if(document1.isNewNote()) {
var vUNID = session.evaluate("#Unique").elementAt(0);
document1.setValue("OrderUNID", vUNID);
viewScope.vsOrderUNID = vUNID;
}
}]]></xe:this.action>
</xp:eventHandler>
</xe:djFilteringSelect>
Take a look here http://tc-soft.com/blog/377
Your second combo has to be refreshed by the first one. So first combo must fire partial refresh to the area of second combo.

Insert datetime in Excel with JSP

I've the below JSP to insert values into Excel.
<%#page import="java.util.Locale"%>
<%#page import="java.text.SimpleDateFormat"%>
<%#page import="java.sql.*"%>
<%
Connection con = null;
Statement stmt = null;
java.util.Date dt=new java.util.Date();
try {
String a = request.getParameter("comments");
String b = request.getParameter("updatedl");
String c = request.getParameter("sid");
String d = request.getParameter("desc");
String e = request.getParameter("pubcode");
String f = request.getParameter("Type");
String g = request.getParameter("status");
String h = null;
if (null != request.getParameter("DateRec")) {
h = request.getParameter("DateRec");
}
String i = null;
if (null != request.getParameter("startD")) {
i = request.getParameter("startD");
}
String j = null;
if (null != request.getParameter("AssignedD")) {
j = request.getParameter("AssignedD");
}
String k = null;
if (null != request.getParameter("sentToAE")) {
k = request.getParameter("sentToAE");
}
String l = null;
if (null != request.getParameter("RespFrmAE")) {
l = request.getParameter("RespFrmAE");
}
String m = null;
if (null != request.getParameter("VWRCmp")) {
m = request.getParameter("VWRCmp");
}
String n = request.getParameter("PS");
String o = request.getParameter("TEst");
String p = request.getParameter("Units");
String q = null;
if (null != request.getParameter("VWR")) {
q = request.getParameter("VWR");
}
String r = request.getParameter("IE");
String s = null;
if (null != request.getParameter("RevDate")) {
s = request.getParameter("RevDate");
}
String t = request.getParameter("ReviewS");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:/jus/Excel1.xls; ReadOnly=true;");
String query = null;
String columnString = new String();
String values = new String();
columnString = "insert into [Feb$] ([comments],[No of lines updated in PSIS],[Shipment ID],"
+ "[SAP TXT Description],[Phoenix Pub Code], [Product Type]" ;
values = " values("+ a + "," + b + "," + c + ",'" + d + "','" + e + "','" + f + "'";
out.println("h value "+n);
if(null!= g && !g.isEmpty()){
columnString = columnString+(",[Status of the job]");
values = values + ",'" +g;
}
if(null!= n && !n.isEmpty()){
columnString = columnString+(",[Assigned to PS]");
values = values + "','" +n;
}
if(null!= o && !o.isEmpty()){
columnString = columnString+(",[Time Estimate]");
values = values + "','" +o;
}
if(null!= p && !p.isEmpty()){
columnString = columnString+(",[Units]");
values = values + "','" +p;
}
if(null!= r && !r.isEmpty()){
columnString = columnString+(",[Internal Errors]");
values = values + "','" +r;
}
if(null!= t && !t.isEmpty()){
columnString = columnString+(",[Review Sent (Yes/No)]");
values = values + "','" +t;
}
if(null!= h && !h.isEmpty()){
columnString = columnString+(",[Date Request received]");
values = values + "','" +h;
}
if(null!= i && !i.isEmpty()){
columnString = columnString+(",[Start Date]");
values = values + "','" +i;
}
if(null!= j && !j.isEmpty()){
columnString = columnString+(",[Date assigned]");
values = values + "','" +j;
}
if(null!= k && !k.isEmpty()){
columnString = columnString+(",[Date file sent to AE]");
values = values + "','" +k;
}
if(null!= l&& !l.isEmpty()){
columnString = columnString+(",[Date response from AE]");
values = values + "','" +l;
}
if(null!= m && !m.isEmpty()){
columnString = columnString+(",[Date completed --VWR]");
values = values + "','" +m;
}
if(null!= q && !q.isEmpty()){
columnString = columnString+(",[Date file needs to be sent to Vendor (VWR)]");
values = values + "','" +q;
}
if(null!= s && !s.isEmpty()){
columnString = columnString+(",[Review Date]");
values = values + "','" +s;
}
columnString = columnString+")";
values = values + "')";
query = columnString+values;
out.println(query);
PreparedStatement ps = con.prepareStatement(query);
int new1 = ps.executeUpdate();
String UR = "success.jsp";
response.sendRedirect(UR);
} catch (Exception e) {
out.println(e);
} finally {
try {
stmt.close();
con.close();
} catch (Exception e) {
e.printStackTrace();
}
}
%>
Here the date fields that I'm accessing is getting values from a jquery datepicker in my previous html page, but now I want to concatenate this date with current time and insert in Excel sheet, when I try to concatenate like below, it is giving me an exception.
if(null!= h && !h.isEmpty()){
columnString = columnString+(",[Date Request received]");
values = values + "','" +h+dt;
}
the exception I'm getting is as below.
java.sql.SQLException: [Microsoft][ODBC Excel Driver] Data type mismatch in criteria expression.
please let me know how can i achieve this.
Thanks

Search in view results with multible Fields Xpages

I have tried several times to enter a date range into the Search in view.
The search string i put into Search in view is as follow.
compositeData.Operasjon = "ST-MOD"
" FIELD OprPlanGruppe_1 = " + compositeData.Operasjon + " AND FIELD OprDato_1 = " +
dates.substring(0, dates.length() - 1);
The result is that only the last key value pair (FIELD OprDato_1 = 11.02.2014) is used to filter
The hole code is below:
var idag:java.util.Date = new java.util.Date();
var cal:java.util.Calendar =java.util.Calendar.getInstance();
var dateFormat:java.text.SimpleDateFormat = new java.text.SimpleDateFormat("dd.MM.yyyy");
cal.set(java.util.Calendar.HOUR_OF_DAY, 0); // ! clear would not reset the hour of day !
cal.clear(java.util.Calendar.MINUTE);
cal.clear(java.util.Calendar.SECOND);
cal.clear(java.util.Calendar.MILLISECOND);
var dates = "";
var i;
for(i = 0; i < 7; i++){
cal.set(java.util.Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek() + i);
dates += dateFormat.format(cal.getTime()) + ",";
}
dates = dates.replace("undefined", "");
return " field OprPlanGruppe_1 = " + compositeData.Operasjon + " AND FIELD OprDato_1 = " + dates.substring(0, dates.length() - 1);
Is there any possibilities to add more than one value after Field in the filter query?
Ex: FIELD OprDato1 = 10.02.2014,11.02.2014
You want to show all documents in view which have in field "OprDato_1" a date that is within the current week. You use the "Search in view results" property of xp:viewPanel. It uses full text search and has to have the syntax of full text search. You can compare dates with ">=" and "<=". So, an easy way to look for dates in a certain date range is
FIELD OprDato_1 >= 10.02.2014 AND FIELD OprDato_1 <= 16.02.2014
or shorter as
[OprDato_1] >= 10.02.2014 AND [OprDato_1] <= 16.02.2014
Your code for calculating the search string would look like this:
var cal:java.util.Calendar =java.util.Calendar.getInstance();
var dateFormat:java.text.SimpleDateFormat = new java.text.SimpleDateFormat("dd.MM.yyyy");
cal.set(java.util.Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
var firstDate = dateFormat.format(cal.getTime());
cal.set(java.util.Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek() + 6);
var lastDate = dateFormat.format(cal.getTime());
return "FIELD OprPlanGruppe_1 = " + compositeData.Operasjon +
" AND FIELD OprDato_1 >= " + firstDate +
" AND FIELD OprDato_1 <= " + lastDate
This code calculates the date range for current week. You are free to set cal to any other date and date range would then be the week of this date.

Comparing #Now to a Date/Time field?

How do I compare #Now to a data / time value in a document? This is what I have
var ProjectActiveTo:NotesDateTime = doc.getItemValueDateTimeArray("ProjectActiveTo")[0];
var ProjectExpired;
var d1:Date = #Now();
if (d1 > ProjectActiveTo.toJavaDate())
{
dBar.info("Today: " + d1 + " > " + ProjectActiveTo.toJavaDate());
ProjectExpired = true;
}
else
{
dBar.info("Today: " + d1 + " < " + ProjectActiveTo.toJavaDate());
ProjectExpired = false;
}
But this always seems to return false. I printed out some diagnostic messages.
Today: 1/18/13 6:02 PM < 1/20/01 5:00 PM
Obviously today is greater than 1/20/01 but this is the result of my test. Why?
I have done some searching and saw that the compare member function might be used but it returns an error for me and compare is not in the intelisense (or whatever Lotus calls it) in the design editor.
Found this little snippet on line - it should point you in the right direction
var doc:NotesDocument = varRowView.getDocument();
var d:NotesDateTime = doc.getItemValue("BidDueDate")[0];
var t:NotesDateTime = session.createDateTime("Today");
if (d.timeDifference(t) > 0 ) {
return "Overdue";
}else{
return "";
}

Resources