• Engineering
  • Who cares about Types? Querying with Numeric Variable Values
  • November 25, 2014

30 Day Free Trial

Bring together legacy systems, RPA bots, microservices and more with Camunda

variable assignment value camunda

Sign Up for Camunda Content

Get the latest on Camunda features, events, top trends, and more.

TRENDING CONTENT

Pro-code, Low-code, and the Role of Camunda

Process Automation CoE Playbook

Behind the scenes, the process engine performs some magic to squeeze numbers, booleans, or even complex Java objects into the database and return it from there on the next call:

With 7.2 (and the latest alpha), we introduce the typed value API. It is not a whole new API but rather of a gentle extension. Like before, the variable API is map-based and no existing code breaks. With the typed value API, performing the same task as above, it is possible to write

You might have noticed the TypedValue which is the very core of this concept. Instead of the plain variable value, there is an intermediate object, the typed value.

What can you do with it? Assume there is a variable called “var” in four different process instances:

The four variables all differ in type and exact value. Yet, all are numeric values. In order to find all process instances with variable value > 10, the following can be written:

Unfortunately, this returns only one process instance, processInstance1 . Why? Because 42 is an integer value and the query only searches for process instances with an integer value greater than 10.

Often, this is not what users want. All values are numeric and can be compared on a conceptual level. That is where typed values come to the rescue. Now, it is possible to write the following process instance query:

This query returns all four process instances. The process engine detects that the types integer , short , long , and double are all subordinates of the type number . It now knows that you do not mean integers with value greater than 10 but any number value that is greater than 10.

Why should you care? Sometimes you don’t know the type a variable in question has. In Cockpit, users specify a numeric value to query with. Its exact type is of little interest. While some MyBatis and SQL hacks made this possible in Cockpit before 7.2, it is now a well-defined API feature. And the best: You can use it in your own queries, wherever variable values can be specified.

That is not all to it; the typed value API has much more to offer. To learn more about it, stay tuned for the release webinar, blog posts, tutorials, and examples to follow. Of course, you can right now have a look at the documentation and discover the typed value API.

Try All Features of Camunda

Related content, how cardinal health is using workflow orchestration to transform patient experiences and outcomes, streamlining camunda apis: building a zeebe rest api, camunda migration methodology.

Variables in the REST API

In the REST API, process variables are represented by JSON objects of the following form:

The REST API supports the Value Types supported by the process engine.

Capitalization of Type Names

In the REST API, the type names start with a capital letter, i.e., String instead of string .

Serialized and Deserialized Object Values

Object Values are instances of (non primitive) Java types. When working with the REST API, it is generally advisable to work with the serialized value of a variable. In that case the value is retrieved from the database and directly returned in the http response. If the client you are building is not a Java Applications by itself, make sure you use a text-based serialization dataformat (such as XML or JSON).

To retrieve the serialized form of a variable, use the deserializeValues=false GET parameter.

Serialize Variables of type Object in REST API

In the REST API, process variables of type Object can be serialized in JSON or XML format.

Serializing Object into JSON format:

Serializing Object into XML format:

On this Page:

We are looking for talented people. Check out our open positions .

Variable labeling

The variable labeling functionality allows users to add, update, and delete batches of variable labels so your data is more understandable by business users. This allows Optimize to display a variable's label instead of its original name anywhere the given process definition is being used. Some examples of that would be when viewing and configuring reports, dashboards, or event-based processes.

To use this feature, navigate to the definition edit window from inside a report. Click the pencil icon while hovering over the data source and click Rename Variables to access the label edit panel. You will then see the following panel:

Label Edit panel

Delete a label by inputting an empty field for its value.

Limitations ​

This feature is currently not supported in task analysis and csv export. This means that during task analysis, the original name of a variable is displayed.

Keep in mind that when applying variable filters in multi-definition reports and multi-definition dashboards, the filters are applied to all variables across definitions which have the same name and type. This happens even in the case that the variables are labeled differently across definitions.

  • Limitations

COMMENTS

  1. Variables

    Variables are part of a process instance and represent the data of the instance. A variable has a name and a JSON value. The visibility of a variable is defined by its variable scope. When automating a process using BPMN or orchestrating human tasks, you can leverage the scope of these variables and customize how variables are merged into the ...

  2. Process Variables

    Process variables can be stored in formats like JSON and XML provided by the Camunda Spin plugin.Spin provides serializers for the variables of type object such that Java variables can be persisted in these formats to the database. Furthermore, it is possible to store JSON and XML documents directly as a Spin object by the value types xml and json. ...

  3. Set variables on task in camunda

    Just make sure the task id is correct and be aware that this sets a Boolean value not a String. On versions < 7.2.0-alpha2. There is no out-of-the-box support for this but you can achive it in the following way: Create a custom extension element that defines the variable and value to set (or reuse the camunda extension elements like above).

  4. Camunda BPM: User Task Assignment based on a DMN Decision Table

    The result variable name, here dmnResult, can be chosen freely. The variable name is subsequently used in the mapping expressions. The final step is to map the output of the business rule task to the three variables used for the task assignment. This can be done on the "Input/Output" properties tab of the business rule task using feel scripts.

  5. Variables

    Access variables. Access the value of a variable by its variable name. a + b. If the value of the variable is a context, a context entry can be accessed by its key. a.b. If no variable exists with the given name, the expression returns null. tip. Use a null-check if the variable can be null or is optional. a != null and a.b > 10.

  6. Get assignee value after task is completed

    For the scenario when we need to know who has completed a certain task in the process before we have used a Task Listener for event type assignment with inline groovy script. task.execution.setVariable('managerId', task.assignee); If the database update has to be performed once the task is completed the same approach can be taken by to use ...

  7. User Task assignment via variables in camunda 8

    Is it still possible to make assignment via variables in Camunda Platform 8?. In Camunda Platform 7 this was still possible, similar to this example: Camunda BPM: User Task Assignment based on a DMN Decision Table. I have tried using variables in Camunda Platform 8, but without success. I use Camunda Platform 8 Self-Managed.. How are variables inserted in the new version?

  8. Who cares about Types? Querying with Numeric Variable Values

    The final camunda 7.2 release is a stone's throw away and ships a ton of new features. One of these is the typed variable value API. You may already know the plain-value-based API that exists since the process engine's very first days. A variable can be set on an execution/task/… as follows: execution.setVariable("var", 42);

  9. Object and List Variable Support

    Optimize also supports object variables which are JSON serialized lists of primitive types, for example a list of strings or numbers. Note that for Camunda Platform and external variables, the type of list variables must still be set to Object. During import, Optimize also evaluate how many entries are in a given list and persists this in an ...

  10. How to assigne a task for a user

    Using expressions or task listener you can set assignee for the task which was entered in the form. Note that variable should match the variable in the form. Refer the below model, other way is, writing task listener and configure it in start event of the user task and set it via delegateTask.setAssignee ("83282929"); Note: Assignee field is of ...

  11. DMN Decision Table Input

    A decision table can have one or more inputs, also called input clauses. An input clause defines the id, label, expression and type of a decision table input. An input can be edited by double-clicking on the respective colum header in the decision table. An input clause is represented by an input element inside a decisionTable XML element.

  12. How to display the value of a process variable in Camunda Forms

    The proposed method will link the form field to the variable, so that when the user alters the value in the Camunda Form, it will alter the corresponding process variable to the new value. This is working properly. My issue is, is there a way to display the current value of the variable in a text field, in a dynamic manner?

  13. Variables in the REST API

    Serialized and Deserialized Object Values. Object Values are instances of (non primitive) Java types. When working with the REST API, it is generally advisable to work with the serialized value of a variable. In that case the value is retrieved from the database and directly returned in the http response.

  14. Variable labeling

    Variable labeling. The variable labeling functionality allows users to add, update, and delete batches of variable labels so your data is more understandable by business users. This allows Optimize to display a variable's label instead of its original name anywhere the given process definition is being used. Some examples of that would be when ...