Query for process variable for cockpit KPI plugin

98 views
Skip to first unread message

Greg Svitak

unread,
Feb 19, 2016, 12:31:17 PM2/19/16
to camunda BPM users
Hello

I would like to write a cockpit plugin to show the KPIs for my processes. In general, I would like to display some stats based some of the process variables. I have looked at the sample cockpit plugins and the samples are great (thank you). However I do not see the best way to query for process variables for this type of requirements. 

Do I use the API or would it be best to do SQL queries that map to a DTO object like the samples show?

Thanks
Greg

Greg Svitak

unread,
Feb 19, 2016, 12:34:09 PM2/19/16
to camunda BPM users
Sorry I forgot to ask if I should use the history tables for this types of metric. I have not seen any examples for the process variables history table or API calls to handle the queries. Any help would be appreciated.

Greg

thorben....@camunda.com

unread,
Feb 22, 2016, 3:42:54 AM2/22/16
to camunda BPM users
Hi Greg,

Can you please elaborate on your use case? Can you give an example for such a query?

In general, you have the HistoryService to query historical data. You can use methods like createHistoricProcessInstanceQuery to get a list of process instances that match certain criteria. If you need an aggregated value (e.g. the average duration), it would be inefficient to select all process instances first and calculate the value in your plugin's code. In addition, beginning with the last 7.5.0-alpha the history service has a method #createHistoricProcessInstanceReport to generate aggregated results. That API is currently limited to minimum, maximum, and average duration of process instances in an arbitrary time span. For anything else, I would use a custom query.

Cheers,
Thorben

Greg Svitak

unread,
Feb 22, 2016, 11:18:07 AM2/22/16
to camunda BPM users
Hi Thorben,

Thanks for the reply. Basically we have some date fields in the forms that we are storing as process variables because we need to use the dates for the workflow processing. However we would like to have charts and graphs showing the current status of the tasks based on these date fields. We have do some math based on the dates as well. I know the task due dates are available but we need some specific requirements where due dates will not work.

Any guidance would be appreciated.

Thanks
Greg 

webcyberrob

unread,
Feb 22, 2016, 5:12:37 PM2/22/16
to camunda BPM users
Hi if you look in the plugin store, there is a kpi plugin. This uses a custom query and the code is in the code repository. This could give you some inspiration...

Rob

Greg Svitak

unread,
Feb 22, 2016, 11:01:04 PM2/22/16
to camunda BPM users
Hi Rob

Thanks for the suggestion. I did look in the plugin store and spent some time checking out the code. The queries are very helpful but they focus more on the properties of the task. I have not found an example on how to query the process variables history tables.

Do you have happen to know of some good examples?

Thanks,
Greg
Reply all
Reply to author
Forward
0 new messages