Open Edition

Open Editions

Come for answers. Stay for best practices. All we’re missing is you.


#Data
#Businessautomation
#Data
 View Only
  • 1.  DMNLiteralExpressionEvaluator Error

    Posted Thu November 28, 2024 10:35 AM

    Hi Everyone,

    I hope this message finds you well.

    I am currently working on a decision model in IBM DMN Canvas and have encountered some issues while trying to extract the year from a date field. Below are the details of the problems:

    1. Year Extraction Issue: While attempting to use the date(getDOB).year expression, the following error is generated: 

    extended_services  | 2024-11-28 14:38:45,195 ERROR [org.kie.dmn.cor.ast.DMNLiteralExpressionEvaluator] (executor-thread-30) FEEL ERROR while evaluating literal expression 'date(getDOB).year': The parameter 'from', in function date(), cannot be null.

    according to the error, getDOB is null but I have verified it is not null.

    2. Dependency Value Error: Another error I noticed is related to the Customer dependency type:

    extended_services  | 2024-11-28 15:21:49,046 ERROR [org.kie.dmn.cor.imp.DMNRuntimeImpl] (executor-thread-43) Error while evaluating node 'New Decision' for dependency 'Customer': the dependency value '[{empType=string, otherDescription=string, tdsInco... [string clipped after 50 chars, total length is 3114]' is not allowed by the declared type (DMNType{ https://kie.org/dmn/_2C4DF60B-8CD3-453E-8412-173AF357EF1E : Customer })

    Steps Taken:

    Verified the data mappings and types for Application.requestDate and Customer.dateOfBirth.

    Attached is a screenshot of the DMN canvas for your reference.

    Thank you for your assistance. Please let me know if additional details are required.



    ------------------------------
    Kishan Kumar
    ------------------------------


  • 2.  RE: DMNLiteralExpressionEvaluator Error

    Posted Thu November 28, 2024 10:49 AM

    Hi Kishan, 

    I think these problems may be caused by type mismatches. However to better know, it would be great, if you could provide a short DMN file, with which the problem could be reproduced. When having such file, I could try to reproduce the problem and see, what could be causing it. 

    Example - the date() function requires a date string as a parameter (1). However, I see you have getDOB defined as Any, so it is not clear, that it contains strings all the time. 

    Best regards,

    Tibor

    (1) https://kiegroup.github.io/dmn-feel-handbook/#date-from-string



    ------------------------------
    Tibor Zimányi
    ------------------------------



  • 3.  RE: DMNLiteralExpressionEvaluator Error

    Posted Fri November 29, 2024 03:44 AM

    Hi Tibor,

    Thank you for your assistance.

    I change any to string then it works



    ------------------------------
    Kishan Kumar
    ------------------------------



  • 4.  RE: DMNLiteralExpressionEvaluator Error

    Posted Mon December 09, 2024 12:14 PM

    Hi Tibor,

    The issue you're facing appears to involve an error in evaluating a DMN literal expression. The error message indicates a problem with the parameter from in the date() or years and months duration() functions, particularly involving XML Schema compliance.

    Error Details:

    • The error states: "The parameter 'from', in function date() or years and months duration(), is not compliant with XML Schema Part 2 Datatypes."
    • This typically means that the input value passed to the date() function does not match the expected format (YYYY-MM-DD).

    Other logic

    Note - With this logic same error getting

    Debugging Steps:

    1. Test the DMN model directly in the Swagger-UI with inputs, we are getting excepted output.



    ------------------------------
    Kishan Kumar
    ------------------------------



  • 5.  RE: DMNLiteralExpressionEvaluator Error

    Posted Tue December 10, 2024 03:45 AM

    Hi Kishan,

    thank you for sharing this interesting problem. I struggle to reproduce it locally, however I think it is because I do not know the exact definition of the Customer and Application. I think to reproduce the issue I need to know the data types of the fields:

    • dateReported
    • createdOn
      Example of multiple nested conversions: string, date


    ------------------------------
    Jozef Marko
    Software Developer
    IBM
    ------------------------------



  • 6.  RE: DMNLiteralExpressionEvaluator Error

    Posted Tue December 10, 2024 05:03 AM

    Hi Kishan, 

    yes, that is correct. The DMN specification defines the date format, that needs to be used. The error message mentions the format. What is the return type of the e.g. debtElement.dateReported or Application.createdOn fields defined in the DMN model, please? If it is defined as "Any", that may be a problem and you need to change that. The string() function uses this method (1) to format the value and for Date, Time and DateTime based types, it uses a formatter with the format based on the DMN specification. 

    Best regards,

    Tibor

    (1) https://github.com/apache/incubator-kie-drools/blob/16897949cb6b691ec6b919cd4593288ebbd00cee/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/util/TypeUtil.java#L77



    ------------------------------
    Tibor Zimányi
    ------------------------------