Dmn Modeler - check input string length and admit only digit

Hello everyone, I would like to create conditions for 2 input string with dmn Modeler :

  1. Only string of length 3: I have tried with length(myString)!=3, length(myString)not(3) and other alternatives, unfortunately always not successful
  2. Only digits should be entered, comparatively NaN of JavaScript: I have used not(number) and other alternatives, unfortunately always not successful
    I’ve tried a lot of alternatives, but unsuccessful.
    Does anyone know how I could write these terms with dmn Modeler?
    Many thanks in advance.

You can check for this by using FEEL to get the length like this string length("foo")
More details are here: https://camunda.github.io/feel-scala/docs/reference/builtin-functions/feel-built-in-functions-string

You can find more details about how to use feel your use cases by checking out this Documentation

1 Like

Thanks for your post, i took a look of this documentation ,but no success. I don,t like to get the length of the input string, but i like to set a condition that the input string should have a length 3 like length(myString)!=3 , but what i tried does not work

Hi @Achille,

Try below expression
string length(?) != 3

The input value can be accessed in the expression by using the symbol ? (a question mark).

Thanks @hassang
I found the solutions to my problems

The inputString should have length 3
string length(inputString) !=3

The inputString should contain only character
matches(inputString, “[a-zA]”)

1 Like