Feel-scala Questions and Errors on Camunda BPM

Hi guys, i’m tring to implement feel-scala with camunda plugin “feel-engine-plugin-1.10.1-complete.jar”.
I require this because i need to make some validations of dmn 1.2 standard, this plugin says that support it.
i have some questions:

This plugin works properly with camunda dmn engine rest API?

I really got miss on documentation…

I’m got the following errors:

When i make a request with data type “feel-time”:
QUERY
{
“variables” : {
“vchVar1” : { “value” : “FDO”, “type” : “string” },
“vchHora” : { “value” : “09:00:00”, “type” : “date” }
}
}

RESPONSE
{
“type”: “RestException”,
“message”: “Unsupported value type ‘feel-time’”
}

This is the error log when i try with datatype date
DMN-01005 Invalid value ‘09:00:00’ for clause with type ‘feel-time’.

What i need is to be able to evaluate rules with time range and weekday:

@jefferson try with type as “time” instead of date

i got this
{
“type”: “InvalidRequestException”,
“message”: “”
}

And the server log
org.camunda.commons.logging.BaseLogger.logWarn DMN-01006 Unsupported type ‘time’ for clause. Values of this clause will not transform into another type

@jefferson can you upload your dmn?

sure…
Fondos.dmn (1.9 KB)

this is the query json
{
“variables” : {
“vchVar1” : { “value” : “FDO”}, “type”: “string”},
“vchHora” : { “value” : “10:31:10”, “type”: “time” }
}

and this is the server return

{
“type”: “InvalidRequestException”,
“message”: “”
}

and there is no more logs from bpm server, this is the last one…
[http-nio-8080-exec-9] org.camunda.commons.logging.BaseLogger.logWarn DMN-01006 Unsupported type ‘time’ for clause. Values of this clause will not transform into another type.

there was an error in the json:
{
“variables” : {
“vchVar1” : { “value” : “FDO”, “type” : “string” },
“vchHora” : { “value” : “10:00:00”, “type” : “time” }
}
}
RESPONSE
{
“type”: “RestException”,
“message”: “Unsupported value type ‘time’”
}

FYI: Data Type Error using the plugin with CAMUNDA BPM DMN ENGINE · Issue #92 · camunda/feel-scala · GitHub

It seems that this is not a problem with the FEEL engine itself. I can evaluate your DMN in a JUnit test (see the Github issue). I think the variable type time is not supported by Camunda BPM 7.12.
"vchHora" : { "value" : "10:00:00", "type" : "time" }. I’m not sure how to pass it over the Camunda REST API.

Right, i think the documentation of this plugin is overwhelming, there say’s that “time” and “feel-time” data type is allowed.

(Here)https://camunda.github.io/feel-scala/feel-data-types
(And Here)https://camunda.github.io/feel-scala/camunda-setting-data-types-in-decision

SOLUTION

Anyway i guess there is a lot of people looking for a solution to handle Business days and day Hours rules in camunda dmn.
I will post here a script to do this.

TO HANDLE HOURS OR BUSINESS HOURS:

In the Input Expression the following JavaScript
In the input variable you must set the var “tiempo

var d = new Date(dateInput); 
tiempo = d.getHours();

So, now you can handle the hours (without mins or secs) in a format from 0 to 24
image

TO HANDLE DAYS OR BUSINESS DAYS

In the Input Expression the following JavaScript
In the input variable you must set the var “dia

var InputDate = new Date(new Date(dateInput2).setHours(0,0,0));
dia = InputDate.getDay()

So, now you can handle the days (without mins or secs) in a format from 0 to 6
0=Monday
6=saturday

image

I hope this could be helpful for some one else

1 Like

@jefferson, thank you for sharing your solution :+1:

I just want to mention an alternative. Since the problem is the REST API and not the FEEL engine itself, the time could also be passed as type string "10:00:00" in the REST API. In the input expression, the string can be transformed into a time type via time(vchHora) FEEL expression.
The type of the input should be set to feel-time.