formatDateTime function

0
I have a strange issue with this function. When I run the microflow with the debugger I don’t get error messages: formatDateTimeUTC($DS_GetAnalysis_by_URL_Table/ANALYSIS_RUNTIME, 'yyyy-MM-dd HH:mm:ss') When I get to the page and widget that calls the microflow I receive the following error: Caused by: com.mendix.modules.microflowengine.MicroflowException: Failed to evaluate expression, error occurred on line 1, character 1 formatDateTimeUTC($DS_COLUMN_ANALYSIS/ANALYSIS_RUNTIME, 'yyyy-MM-dd HH:mm:ss') ^     at SmartStreams.Get_SimpleStatistics_IndName (CreateOrChangeVariable : 'Create String variable') Advanced stacktrace:     at com.mendix.languages.mxexpressions.MxExpression.evaluate(MxExpression.scala:26) Caused by: com.mendix.languages.expressions.ExpressionException: com.mendix.systemwideinterfaces.MendixRuntimeException: Unsupported number of parameters: 2     at com.mendix.languages.expressions.Expr.evaluate(Expr.java:22) I did several tests and I found that when I get the error when using the variable from the database : $DS_GetAnalysis_by_URL_Table/ANALYSIS_RUNTIME. If I replace this variable with the system variable [%CurrentDateTime%] I don’t get the error. I suspected that it may be a format difference between the values of the two variables but they look exactly the same. More than that although I get the error message and window the function works and returns the right value after clicking Cancel. In the Studio debugger, the two variables have identical format/pattern as date and string data types. . It looks like a bug to me. Please assist.   Regards, Costin Marzea  
asked
6 answers
2

Hi Costin,

Looks like everything seems to be good based on string variable

Just try out like this As srilatha suggested

As per your string variable to get space between date and time value, Just try out this as shown below

formatDateTime($object/Date1,'yyyy-MM-dd') +’   ‘+ formatDateTime($object/Date1,'HH:mm:ss')

answered
1

Hi,

Try with concatenating the two format dates functions,instead of using in a single function :

formatDateTime($object/Date1,'yyyy-MM-dd') + formatDateTime($object/Date1,'HH:mm:ss')

answered
0

Hi,

 

Thank you for your prompt response.

Unfortunately, I got the same error:

Caused by: com.mendix.modules.microflowengine.MicroflowException: Failed to evaluate expression, error occurred on line 1, character 1
formatDateTimeUTC($DS_GetAnalysis_by_URL_Table/ANALYSIS_RUNTIME,'yyyy-MM-dd')+' '+formatDateTimeUTC($DS_GetAnalysis_by_URL_Table/ANALYSIS_RUNTIME,'HH:mm:ss')
^
    at SmartStreams.Get_DataAnalysis_Detail_BKUP (CreateOrChangeVariable : 'Create String variable')

Advanced stacktrace:
    at com.mendix.languages.mxexpressions.MxExpression.evaluate(MxExpression.scala:26)

Caused by: com.mendix.languages.expressions.ExpressionException: com.mendix.systemwideinterfaces.MendixRuntimeException: Unsupported number of parameters: 2
    at com.mendix.languages.expressions.Expr.evaluate(Expr.java:22)

When I removed the pattern:

formatDateTimeUTC($DS_GetAnalysis_by_URL_Table/ANALYSIS_RUNTIME)

I got the error:

Caused by: com.mendix.modules.microflowengine.MicroflowException: Failed to evaluate expression, error occurred on line 1, character 1
formatDateTimeUTC($DS_GetAnalysis_by_URL_Table/ANALYSIS_RUNTIME)
^
    at SmartStreams.Get_DataAnalysis_Detail_BKUP (CreateOrChangeVariable : 'Create String variable')

Advanced stacktrace:
    at com.mendix.languages.mxexpressions.MxExpression.evaluate(MxExpression.scala:26)

Caused by: com.mendix.languages.expressions.ExpressionException: com.mendix.systemwideinterfaces.MendixRuntimeException: Unsupported number of parameters: 1

 In fact the function works fine, the message is unnecessary. Why I didn’t get an error messge when I used the system variable  [%CurrentDateTime%] ?

answered
0

Are you sure the  Datetime_* string variables contain the same format data?

Sometimes the debugger shows data differently: a string like “/Date(1574899200000)/” is shown in the debugger as datetime.

 

See also: https://forum.mendix.com/link/questions/98262

answered
0

Hi,

It could be that the value being returned is empty, that’s why it might throw this error. Worked for me.

Cheers!

answered
0

formatDateTime([%CurrentDateTime%],'EEEE dd MMM yyyy hh:mm:ss:SS a')

What is  the error here?

answered