New Release of the FEEL extension 1.5.0


#1

Hi DMN-enthusiasts!

A new version of the FEEL extension is released.

New Features:

  • use boolean expression as unary test
  • support ‘?’ for unary test as alias for the input value
  • subtract date from date/duration
  • add date to duration
  • support Camunda Spin JSON/XML variables
  • support quoted names as identifiers

Fixes:

  • map BigInt / BigInteger as FEEL number
  • transform whole numbers to long instead of double

You can download the extension from GitHub. Enjoy!

Best regards,
Philipp


#2

Hi @Philipp_Ossler,

I’d be keen to give it a try in a standard Tomcat-based distribution (7.9) - we need some complex checks for date data type.
However, I can’t find a valid way to include configuration of the plugin into bpm-platform.xml. Would appreciate your sharing of a valid bpm-platform.xml config?

Thank you in advance.

Best regards,
Ilya


#3

Hi @Ilya_Malyarenko,

all you need to do is to add a new plugin element. Your config should look like

<?xml version="1.0" encoding="UTF-8"?>
<bpm-platform xmlns="http://www.camunda.org/schema/1.0/BpmPlatform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.camunda.org/schema/1.0/BpmPlatform http://www.camunda.org/schema/1.0/BpmPlatform ">
  <!-- ... -->
 
  <process-engine name="default">
    <!-- ... -->
    <plugins>
      <!-- plugin enabling Process Application event listener support -->
      <plugin>
        <class>org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin</class>
      </plugin>
      <!-- ... -->
     <plugin>
        <class>org.camunda.feel.CamundaFeelEnginePlugin</class>
      </plugin>
    </plugins>
  </process-engine>
</bpm-platform>

Does this help you?

Best regards,
Philipp


#4

Hi @Philipp_Ossler

Appreciate your prompt reply. My bad - the bpm-platform.xml was correct, I just downloaded a wrong JAR. Now it works.

Thank you!

Best regards,
Ilya


#5

Hi @Philipp_Ossler,

I did a bit of tests with FEEL-Scala extension. Looks awesome and runs fast. One question related to handling complex data types. I am looking for a good example of implementing a case of list/context based rules.

So we have a table of manual journal entries (lines) that needs to be validated against a collection of rules. At the moment we implemented Array pattern and send lines one by one to be validated. In this case for each line we return a list of failed validations with error messages. This is not fast and require “process wrapper” around DMN.

diagram_2 - Copy.dmn (1.6 KB)
validations_example.bpmn (11.1 KB)

We would like to implement rules on the whole dataset, so an output would be slightly different. Each failed rule will return a list of input lines that failed validation test with corresponding error message. So we will need to dynamically populate output variables from input expressions. Ideally, we are looking for a way to do it without bpmn orchestrator, but rather running REST calls to DMN engine directly.

Is it something achievable with FEEL?

Thank you in advance.

Best regards,
Ilya


#6

Hi @Ilya_Malyarenko,

yes, I think this should be possible.

If I understand you correctly then you can use the following expression. The variable collection is a list of the data.

{
  check1: {
    error: "Document Type invalid for current year posting",
    violations: collection[documentType = "S2" and glDate > startFiscalYear] 
  },
  check2: {
    error: "Document Type invalid for current year posting",
    violations: collection[ledgerType = "GP" and foreignAmount != null] 
  },
  result: ([check1, check2])[count(violations) > 0] 
}

Does this work for you?

Best regards,
Philipp


#7

Hi @Philipp_Ossler,

Really appreciate your prompt reply. It looks like a miracle to me, because:

  • It works really fast
  • It automatically extracts properties from JSON objects (how is that possible without referencing SPIN?!)
  • It returns rich context information (actually - failing lines) - that is something we were looking for

@Philipp_Ossler, can you please recommend any practical introduction to read to better understand what is happening behind the scenes?

I am attaching bpmn and dmn for others who would be keen to give it a try (FEEL plugin is a prerequisite).

validations_example_singe_malt.bpmn (10.3 KB)
feel_drd.dmn (1002 Bytes)

@StephenOTT - this is an elegant solution proposed by Philipp to your original problem Pattern Review: DMN Looping for Array Input

Best regards,
Ilya


#8

Hi @Ilya_Malyarenko,

I’m happy that you like the extension. You can find some basic information about how to use it in the wiki. If you want to have a deeper look into FEEL then you can have a look into the specification. In case, you’re interested in how the things work then you can look into the code.

Best regards,
Philipp


#9

Hi @Philipp_Ossler,

Thanks for sharing. Already into FEEL spec. Not an easy read :wink:

Best regards,
Ilya