TN createDocumentQuery can it take a date range

Hi there - I’m trying to create a Trading Networks “document transfer report” using public TN services. However, services like 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?

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” );

SimpleDocQuery sdq=null ;
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);
sdq.setTimeInterval(new Timestamp(date.getTime()), new Timestamp(date1.getTime()));

catch(Throwable throwable)

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

I am trying to create a similar query on conversations. Any idea which class the query object for a conversation belongs to.

Hi sonam,

I have tried your code and it works.

Thank you.

It is a pity that the custom dates can be set only using the TN Java API.

Best regards,
Vlad Turian