Hi Mohamed,
Indeed, there exists mechanism to inject dynamic variables into the SQL. The SQL itself is treated as a template which is parsed before executing. The template allows a set of predefined commands (enclosed between braces {}). For instance, you can add to the SQL, clauses on the current filter criteria the user has selected in the dashboard (details here:
http://dashbuilder.blogspot.com.es/2014/12/using-flltered-sql-queries-for-building.html). Another thing you can do in is to add variables to your HTML panels. The HTML panel help (see attached screenshot) shows the list of available commands. A
s you can see both the SQLs and the HTML you edit in the dashboards are templates where you can inject variables from the dashboard context (filter criteria, data displayed, navigation status, logged user, ...). I do not now what information you need to inject into your SQL. I suppose is some kind of information related to the user context. Anyway, you have the possibility to create custom command classes that will be parsed and injected into the templates. For instance, you can create a new command "{current_temperature}" that will be replaced during parse time. You could then use this command into any of your SQL or HTML templates.
To implement a command you nee to provide two implementations:
- A class implementing the CommandFactory interface
- A class extending the AbstractCommand class
You can take as an example any of the Dashbuilder's command implementations. For instance,
If you're using maven you'll need to add a dependency to the "dashboard-provider-api" module.
<dependency>
<groupId>org.jboss.dashboard-builder</groupId>
<artifactId>dashboard-provider-api</artifactId>
<scope>compile</scope>
<version>6.2.0.Final</version>
</dependency>
Once you have the implementation done, you need to copy the resulting jar into the dashbuilder.war/WEB-INF/lib to make it visible in the dashbuilder's classpath.
If you have further questions do not hesitate to contact me again.
Regards,
- David -