Sending parameter to SQL query in dashboard data provider

277 views
Skip to first unread message

Mohamed Elmasry

unread,
Mar 2, 2015, 2:28:42 PM3/2/15
to jbpm-dev...@googlegroups.com
Hi All,

i need to send parameters somehow to SQL query in data provider page in dashboard and i searched a lot until i found a way to do it 
i did it with in send { } in query to make it expect parameters and knew about command interface ... but i still dig in dark

please if anyone can help me by provide more details how it works and if anyone has documentation for this process and command interface or how to do it professionally and straightforward... that will be really great

hope i could find support here

Thank you all in advance

David Gutiérrez

unread,
Mar 9, 2015, 6:35:14 AM3/9/15
to jbpm-dev...@googlegroups.com
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.  As 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 - 
htmlPanelHelp.png

Deepak kumar singh

unread,
Nov 7, 2019, 1:31:58 AM11/7/19
to jBPM Development
Hi David ,

I need to pass parameter from my external web application to dashbuilder.
Like session of user department etc from from my external web app.
Please help me in this.

Thank you  in advance.



Regards,
Deepak
Reply all
Reply to author
Forward
0 new messages