PDA

View Full Version : TN createDocumentQuery can it take a date range


sonam
10-15-2002, 01:08
Hi there - I'm trying to create a Trading Networks "document transfer report" using public TN services. However, services like wm.tn.query:createDocumentQuery only allow me to select from a list of pre-selected date ranges. For eg: "YESTERDAY", "TODAY", "LAST_WEEK", etc.

Is there any way to create a document query that takes an arbitrary date range?

sonam
10-15-2002, 08:15
I've had some success with the code below. It takes 3 params - a query (object), FromDate and ToDate (both strings) as input. It then maniputes the query object so the query date period is set to these dates. The modified query object is returned as output.
Note: the code is pretty skeletal (no error handling).
---------------------------------------------
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String ToDate = IDataUtil.getString( pipelineCursor, "ToDate" );
Object query = IDataUtil.get( pipelineCursor, "query" );
String FromDate = IDataUtil.getString( pipelineCursor, "FromDate" );
pipelineCursor.destroy();

SimpleDocQuery sdq=null ;
try
{
sdq = (SimpleDocQuery) query;
FromDate = FromDate.trim();
ToDate = ToDate.trim();

SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = simpledateformat.parse(FromDate);
Date date1 = simpledateformat.parse(ToDate);
if(date1.after(date))
sdq.setTimeInterval(new Timestamp(date.getTime()), new Timestamp(date1.getTime()));

}
catch(Throwable throwable)
{
}
finally
{
}


// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
Object query_1 = new Object();
IDataUtil.put( pipelineCursor_1, "query", sdq );
IDataUtil.put( pipelineCursor_1, "queryDesc", sdq.toString() );
pipelineCursor_1.destroy();
----------------------------------------------------------

suryas
02-26-2004, 17:58
I am trying to create a similar query on conversations. Any idea which class the query object for a conversation belongs to.