how to find out days between two dates ?

1
hello i am having this error message ?  com.mendix.modules.microflowengine.MicroflowException: Failed to evaluate expression, error occurred on line 1, character 1 $IteratorInboundShipment/EXPIRED = true ^     at NativeMobile.ACT_Create_Sectional_Shipment_Helper.nested.18ead6c1-2076-42de-9bd6-96b59c7e2d1e [0 of 24] (Gateway : 'Expired?')     at NativeMobile.ACT_Create_Sectional_Shipment_Helper (ListLoop : '')     at NativeMobile.ACT_Get_CustomerPickUp_List (SubMicroflow : 'ACT_Create_Sectional_Shipment_Helper') Advanced stacktrace:     at com.mendix.languages.mxexpressions.MxExpressionImpl.evaluate(MxExpressionImpl.scala:32) Caused by: com.mendix.languages.expressions.ExpressionException: An error occurred while executing the action 'NativeMobile.ACT_Calculate_Shipment_Expired'     at com.mendix.languages.expressions.Expr.evaluate(Expr.scala:16) Caused by: com.mendix.core.CoreRuntimeException: An error occurred while executing the action 'NativeMobile.ACT_Calculate_Shipment_Expired'     at com.mendix.basis.objectmanagement.MendixObjectMemberImpl.getValue(MendixObjectMemberImpl.java:221) Caused by: com.mendix.modules.microflowengine.MicroflowException: Failed to evaluate expression, error occurred on line 6, character 1 if($InboundShipment/SHIPMENT_5TH_BUS_DATE!= empty and $InboundShipment/SHIPMENT_5TH_BUS_DATE != '' and $InboundShipment/SHIPMENT_5TH_BUS_DATE !='NA') then if (daysBetween (parseDateTime($InboundShipment/SHIPMENT_5TH_BUS_DATE, 'yyyy-MM-dd''T''HH:mm:ss.SSS'), parseDateTime(toString([%CurrentDateTime%]), 'yyyy-MM-dd''T''HH:mm:ss.SSS')) >= 0) ^ then true else false else false
asked
2 answers
1

expression can return error if the data that you use is empty or different from what the expression is expecting. 

I will recommand you to put a breakpoint in the microflow, and check in the variables tab what is the value of $InboundShipment/SHIPMENT_5TH_BUS_DATE 

If this value seems to be correct maybe try to separate your condition in different variables. For example parseDateTime($InboundShipment/SHIPMENT_5TH_BUS_DATE,
'yyyy-MM-dd''T''HH:mm:ss.SSS') inside a new variable. same for toString([%CurrentDateTime%]) etc…

Doing so you should be able (with the debugger) to see where is the problem.

 

answered
1

 

The value of $InboundShipment/SHIPMENT_5TH_BUS_DATE is not matching a value which can be parsed into a date. Causing this function to fail: (parseDateTime($InboundShipment/SHIPMENT_5TH_BUS_DATE,
'yyyy-MM-dd''T''HH:mm:ss.SSS')

 

I would debug the microflow to find the value used in the microflow, to find the root cause of the value

answered