NAV 2016: FatalError when applying date filter

Hi,

Got a weird error I don’t know what to do about.

I have a simple table Job Shift, it’s primary key is a Job No. and a Date.

In a cue table I have created a flow field counting the number of records in the shift table.

As soon as I apply the date filter to the flow field, then the client crashes with this message:

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: Microsoft.Dynamics.Nav.Client
Problem Signature 02: 9.0.45834.0
Problem Signature 03: 5723b44c
Problem Signature 04: Microsoft.Dynamics.Nav.Client.WinClient
Problem Signature 05: 9.0.45834.0
Problem Signature 06: 5723b446
Problem Signature 07: 5d
Problem Signature 08: 80
Problem Signature 09: FatalError
OS Version: 6.3.9600.2.0.0.400.8
Locale ID: 1030
Additional Information 1: d965
Additional Information 2: d96505cc22c28e6ffaca984aa0afd61f
Additional Information 3: 370c
Additional Information 4: 370cd3a13a5f120686575451bc89d624

As you can see then I have even applied the latest cumulative upgrade 7 to check that it wasn’t a problem that was fixed.

The problem also occurs when running the table object directly and applying the date filter manually.

Have anyone seen this issue before?

And I can add this from the event log:

Type: System.InvalidCastException
Message: Specified cast is not valid.
StackTrace:
at Microsoft.Dynamics.Nav.Client.WinClient.ExceptionHandler.<>c__DisplayClass6.b__4()
at Microsoft.Dynamics.Nav.Client.WinClient.NavClientErrorHandler.ExecuteAndCatchExceptions(Func1 execute)* *at Microsoft.Dynamics.Nav.Client.WinClient.ExceptionHandler.DoExecute(Func1 execute)
at Microsoft.Dynamics.Nav.Client.WinClient.ExceptionHandler.DoRethrowWithCatchException(Exception exception, Boolean designMode)
Source: Microsoft.Dynamics.Nav.Client.WinClient
HResult: -2147467262
----------------------------------
Type: System.InvalidCastException
Message: Specified cast is not valid.
StackTrace:
at Microsoft.Dynamics.Nav.Client.Formatters.NavBaseDateTimeFormatter.ValueToStringInternal(Object value, LogicalControl control, IFormatProvider formatProvider, Boolean displayFormat)
at Microsoft.Dynamics.Nav.Client.Formatters.NavBaseDateTimeFormatter.ValueToString(Object value, LogicalControl control, IFormatProvider formatProvider)
at Microsoft.Dynamics.Nav.Client.UIPatterns.CaptionManager.GetFieldStringFromValue(NavBindingManager bindingManager, String stringFieldId, Object fieldObject, IFormatProvider formatProvider)
at Microsoft.Dynamics.Nav.Client.UIPatterns.CaptionManager.BuildListDynamicCaption(NavBindingManager bindingManager, IFormatProvider formatProvider)
at Microsoft.Dynamics.Nav.Client.UIPatterns.CaptionManager.BuildDynamicCaption(LogicalForm form, NavBindingManager bindingManager, IFormatProvider formatProvider)
at Microsoft.Dynamics.Nav.Client.UIPatterns.CaptionManager.UpdatePageCaption(LogicalForm form)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at Microsoft.Dynamics.Framework.UI.BindingManager.ChangeStateToFilled()
at Microsoft.Dynamics.Framework.UI.BindingManager.DoFill(DataReaderFillOptions fillOptions)
at Microsoft.Dynamics.Framework.UI.BindingManager.Fill(BindingManagerFillOptions options)
at Microsoft.Dynamics.Framework.UI.LogicalForm.LoadDataInternal()
at Microsoft.Dynamics.Framework.UI.LogicalForm.LoadData()
at Microsoft.Dynamics.Framework.UI.Windows.LogicalFormAdapterBase.OnLoadData()
at Microsoft.Dynamics.Framework.UI.Windows.LogicalFormAdapterBase.LoadDataInternal()
at Microsoft.Dynamics.Framework.UI.Windows.LogicalFormAdapterBase.Load(LogicalControl originatingLogicalControl, Boolean loadDataDelayed)
at Microsoft.Dynamics.Framework.UI.Windows.ClientSessionBase.OnFormToShow(LogicalForm logicalFormToShow, LogicalControl originatingLogicalControl)
at Microsoft.Dynamics.Framework.UI.WinForms.ClientSession.OnFormToShow(LogicalForm logicalFormToShow, LogicalControl originatingLogicalControl)
at Microsoft.Dynamics.Framework.UI.UISession.OnFormToShow(FormSessionEventArgs e)
at Microsoft.Dynamics.Nav.Client.PageRunCallbackHandler.RunPage(FormRunRequest formRequest)
at Microsoft.Dynamics.Nav.Client.ServiceConnection.ProcessServerResponse(Object response)
at Microsoft.Dynamics.Nav.Client.ServiceConnection.CallServer[T](BeginCallServerMethod beginCallServerMethod, EndCallServerMethod`1 endCallServerMethod)
at Microsoft.Dynamics.Nav.Client.ServiceConnectionBase.DrilldownField(NavRecordState& state, NavDataSet recDataSet, Int32 controlId)
at Microsoft.Dynamics.Nav.Client.DataBinder.NstDataAccess.DrillDownField(String personalizationId, String controlName)
at Microsoft.Dynamics.Nav.Client.Actions.NavDrilldownAction.InvokeDataAction(LogicalControl logicalControl, UISession uiSession)
at Microsoft.Dynamics.Nav.Client.Actions.PageDataAction.InvokeCore(LogicalControl logicalControl, Object state, UISession uiSession)
at Microsoft.Dynamics.Framework.UI.LogicalAction.InvokeCoreWithErrorHandling(LogicalControl logicalControl, Object state, UISession uiSession)
at Microsoft.Dynamics.Framework.UI.LogicalAction.DoInvoke(LogicalControl logicalControl, UISession uiSession)
at Microsoft.Dynamics.Framework.UI.ActionControl.Invoke()
at Microsoft.Dynamics.Framework.UI.Windows.ActionsHelper.ModalitySafe(Action action)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.Stack.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Source: Microsoft.Dynamics.Nav.Client.UI
HResult: -2147467262

is the date field of type date or datime ? the exception shows that the values are formatted to a datime internally. try both types date and datetime. if that does not work, try with integer fields for day,month,year. maybe its a problem that a date field is part of the key.

Thanks, already tried to remove the date field from the key. Didn’t make any difference.
It’s a “normal” NAV date, not a date/time.

Found it!

I removed the Date from the Data caption fields of the table and it fixed the problem.