Friday, January 27, 2006

Reports with binds and versions

To add reports which have bind variables edit your UserReports.xml on linux this is found in ~/.raptor on windows this is in C:\Documents and Settings\[user]\.raptor If the file doesn't exist, within Raptor right click on the "User Defined Reports" and add either a folder or report this will get you the skeleton of the file.

Here's a very simple sql statement which has bind variables. Notice the sql has :BIND1. Then BIND1 is later defined as a bind with a name, description and tooltip. Also BIND1 can have a default value specified in the value tag. If the text "NULL_VALUE" is placed into the default, the prompt for binds will have the null checked.

Notes:

  • Currently there is a bug which requires there be no whitespace between the <binds><bind> and the </bind></binds> This all apply if there is 2 binds the </bind><bind> should have no whitepace. This will be fixed in the next drop.
  • If the reports are in anyway changed in raptor the results will be that the UserReports.xml will be regenerated without the extra information.



<report type="report" enable="true">
<name><![CDATA[Test Report]]></name>
<description><![CDATA[Kris's test report with binds]]></description>
<tooltip><![CDATA[Tooltip for when the bind name is hovered over]]></tooltip>
<query>
<sql><![CDATA[select :BIND1 from dual]]></sql>
<binds><bind id="BIND1">
<prompt><![CDATA[First Bind Variable]]></prompt>
<tooltip><![CDATA[Name or part of name to search for (case insensitive).]]></tooltip>
<value><![CDATA[NULL_VALUE]]></value>
</bind></binds>
</query>
</report>




Now you can also have report which execute difference sql depending on the version of the database. The only difference is in the query xml tag. By adding minversion="XX.ZZ", the query will be limited to run only in that version. I would recommend having a default query for other versions however if there is none the UI will state no applicable query is found for this version.


<report type="report" enable="true">
<name><![CDATA[Test Report]]></name>
<description><![CDATA[Kris's test report with binds]]></description>
<tooltip><![CDATA[Tooltip for when the bind name is hovered over]]></tooltip>
<query minversion="10.1">
<sql><![CDATA[select :BIND10 from dual]]></sql>
<binds><bind id="BIND10">
<prompt><![CDATA[First Bind Variable]]></prompt>
<tooltip><![CDATA[Name or part of name to search for (case insensitive).]]></tooltip>
<value><![CDATA[NULL_VALUE]]></value>
</bind></binds>
</query>
<query>
<sql><![CDATA[select :BIND_OTHER from dual]]></sql>
<binds><bind id="BIND_OTHER">
<prompt><![CDATA[First Bind Variable]]></prompt>
<tooltip><![CDATA[Name or part of name to search for (case insensitive).]]></tooltip>
<value><![CDATA[NULL_VALUE]]></value>
</bind></binds>
</query>
</report>

No comments:

Disqus for Kris' Blog