I'm using Datavision in a Struts-based application. I'm not sure about passing an entire where clause, I've never tried that, but you can easily pass parameters to the report, which obviously you can use in your where clause. Here's some code for doing that:

Report report = new Report();
report.parametersSetManually(true);
Parameter p = report.findParameterByName("myParameterName");
p.setValue(0, "myValue");

If you truly have to set arbitrary where clauses, that probably won't help. One thing you might be able to do is read in the XML of the report, then just modify the <where> element of the <query> element. You could parse if as XML, but what might be easier, since you need to read it into a String anyway to hand off the the Report object, is just locate <where> and </where> in your String, copy from the start of the string until the end of <where> to a StringBuffer, then append the query your user entered, then append the remainder of the original String from the beginning of </where> to the end. A little more work, but nothing mind-shattering.

This is a Query class that takes as a constructor parameter a Report object... I'm not sure if that is any help, but it does have a setWhereClause method... the question is whether it sets it in the Report you pass in, and I don't know the answer. Even if it doesn't, it does have a writeXML method that writes out the full <query> tag, and maybe that will be helpful to you.

If none of this is any help, I suggest hoping on the Datavision mailing list. Jim, the author, has bee helpful to me in the past, I'm sure he'll answer your question promptly.

Frank

From: "Miquel Angel" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: Help with Datavision + Struts
Date: Mon, 14 Jun 2004 09:20:16 +0200

        Hi. We are de developing an application using struts. In this application
we have to develop reports (of course) and we decided to use Datavision. We
want to use datavision in our action classes. We have one problem and we
don't know how to solve it. The problem is:
        The user has a form in wich he or she enters some criteria to select the
records to be listed. ?Can I pass the WHERE  clause to datavision as a
parameter? Something like this: ID > 100 AND ID < 500 AND NAME LIKE
'PETER%'. If I can, do you have any example.

Does anyone have experience with other reporting tool?, is there any other
tool better than datavision?


Thanks in advance.

Miquel Angel Segui


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Getting married? Find great tips, tools and the latest trends at MSN Life Events. http://lifeevents.msn.com/category.aspx?cid=married



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to