IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
Expand all | Collapse all

TN createDocumentQuery can it take a date range

  • 1.  TN createDocumentQuery can it take a date range

    Posted Tue October 15, 2002 07:38 AM

    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?


    #Integration-Server-and-ESB
    #B2B-Integration
    #webMethods


  • 2.  RE: TN createDocumentQuery can it take a date range

    Posted Tue October 15, 2002 02:46 PM

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


    #Integration-Server-and-ESB
    #B2B-Integration
    #webMethods


  • 3.  RE: TN createDocumentQuery can it take a date range

    Posted Fri February 27, 2004 12:29 AM

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


    #webMethods
    #Integration-Server-and-ESB
    #B2B-Integration


  • 4.  RE: TN createDocumentQuery can it take a date range

    Posted Thu December 03, 2015 03:53 AM

    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


    #B2B-Integration
    #webMethods
    #Integration-Server-and-ESB