Skip to main content
Solved

PXParent Definition in Custom DAC Causes Unhandled Exception 'Move Next'


Forum|alt.badge.img
  • Jr Varsity III
  • 16 replies

I’ve completed the T210 course and want to apply the learning to a real-world application by using a custom table to extend Customer with a tab item and multiple fields, rather than using the customization project to add “user” fields which will extend the Business Account table, not the Customer table, and thus add those fields to all related entities.  I know that PXDBDefault and PXParent are needed to link the custom DAC/table to the Customer table.  However, when I add the PXParent attribute to my DAC definition for the key field, it throws the “An unhandled exception has occurred for the function ‘MoveNext’.” when updating the DLL file and when attempting to publish, so the project won’t publish.  If I comment out the PXParent attribute, the project will publish without issues but of course, saving/updating doesn’t work.  How do I figure out what is wrong?  The Trace file does not give me an indication of the issue other than it seems like a DAC issue.  I thought it might be due to the system fields not being in the same order in the DAC and the table, but that wasn’t it.  Thanks.

Beginning of DAC Definition:

  public class ZZCustomerDealerExt : PXBqlTable, IBqlTable
  {
    #region BAccountID
    [PXDBInt(IsKey = true)]
    [PXDBDefault(typeof(Customer.bAccountID))]
    [PXParent(typeof(SelectFrom<Customer>.Where<Customer.bAccountID.
                     IsEqual<ZZCustomerDealerExt.bAccountID.FromCurrent>>))]
    public virtual int? BAccountID { get; set; }
    public abstract class bAccountID : PX.Data.BQL.BqlInt.Field<bAccountID> { }
    #endregion

...

}

Exception Trace:

System.NullReferenceException
Object reference not set to an instance of an object.
 at PX.Data.PXFirstChanceExceptionLogger.ProfilerFirstChanceException(Object o, FirstChanceExceptionEventArgs args)
 at PX.Data.PXDatabaseProviderBase.SelectOriginalValues(Type table, PXDataFieldParam[] realParameters, Boolean selectAllNeeded)
 at PX.Data.PXDatabaseProviderBase.Update(Type table, PXDataFieldParam[] pars)
 at PX.Data.UserRecords.UserRecordsDBUpdater.UpdateVisitedRecordsCachedContentForAllUsers(Nullable`1 transactionID, ModifiedDacEntryForUserRecordsUpdate dacEntry, String entityType)
 at PX.Data.UserRecords.UserRecordsDBUpdater.UpdateUserRecordsForChangedDACs(Nullable`1 transactionID, IEnumerable`1 updatedDacEntries)
 at PX.Data.UserRecords.UserRecordsDBUpdater.UpdateUserRecords(IReadOnlyCollection`1 modifiedDacEntries)
 at PX.Data.PXTransactionScope.Complete(PXGraph graph)
 at PX.Data.PXGraph.TransactionalPersist()
 at PX.Data.PXGraph.RetryTransaction(Action persistBody, Int32 maxRetries)
 at PX.Data.PXGraph.Persist()
 at Customization.CstDbStorage.SaveDocument(CstDocument document, Boolean resetHash)
 at PX.SM.ProjectScriptMaintenance.ProcessItem(CustObjectTypes objectType)
 at PX.Data.PXAction`1.<>c__DisplayClass4_0.<.ctor>b__0(PXAdapter adapter)
 at PX.Data.PXAction`1.RunHandler(PXAdapter adapter)
 at PX.Data.PXAction`1.<Press>d__39.MoveNext()
 at PX.Web.UI.PXBaseDataSource.tryExecutePendingCommand(String viewName, String[] sortcolumns, Boolean[] descendings, Object[] searches, Object[] parameters, PXFilterRow[] filters, DataSourceSelectArguments arguments, Boolean& closeWindowRequired, Int32& adapterStartRow, Int32& adapterTotalRows)
 at PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments)
 at PX.Web.UI.PXDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments)
 at PX.Web.UI.PXDataSourceView.Select(DataSourceSelectArguments arguments, PXDSSelectArguments swarguments, DataSourceViewSelectCallback callback)
 at PX.Web.UI.PXGrid.PerformSelect()
 at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
 at PX.Web.UI.PXGrid.PX.Web.UI.IPXDataBoundControl.EnsureDataBoundInternal()
 at PX.Web.UI.PXCallbackManager.CollectDataControls(Dictionary`2 controlsDic, List`1 controlsList)
 at PX.Web.UI.PXCallbackManager.RenderClientData(PXCallbackResultMethod resultMethod, XmlWriter writer)
 at PX.Web.UI.PXCallbackManager.GetCallbackResultInternal(PXCallbackResultMethod resultMethod)
 at PX.Web.UI.PXCallbackManager.GetCallbackResult(PXCallbackResultMethod resultMethod)
 at System.Web.UI.Page.RenderCallback()
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 at System.Web.UI.Page.ProcessRequest()
 at System.Web.UI.Page.ProcessRequest(HttpContext context)
 at PX.Web.UI.PXPage.ProcessRequest(HttpContext context)
 at ASP.pages_au_au209000_aspx.ProcessRequest(HttpContext context)
 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
 at System.Web.HttpApplication.<>c__DisplayClass285_0.<ExecuteStepImpl>b__0()
 at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
 at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
 at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
 at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
 at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
 at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

 

Best answer by bbohn

I seem to resolve issues just by creating posts.  Right after I created this post, I reviewed the graph extension again and wondered if the view definition needed to be at the top because it was below an event definition.  I tried moving it up to the top of the class, rebuilt the project, and the exception went away when publishing.  I’m still getting an error when saving that BAccountID can’t be null, which I thought PXDBDefault should take care of in all cases.

View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 16 replies
  • Answer
  • February 1, 2025

I seem to resolve issues just by creating posts.  Right after I created this post, I reviewed the graph extension again and wondered if the view definition needed to be at the top because it was below an event definition.  I tried moving it up to the top of the class, rebuilt the project, and the exception went away when publishing.  I’m still getting an error when saving that BAccountID can’t be null, which I thought PXDBDefault should take care of in all cases.


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 16 replies
  • February 1, 2025

Is there something additional that needs to be done to insert a new record in a custom table from a graph extension? I don’t remember doing that in T210 for the tab on Stock Item.  Don’t the PXDBDefault and PXParent attributes facilitate that? 

Once I insert a row into the custom table using SSMS, it works fine afterwards, but changes won’t save because the record wasn’t initially created, and the tab doesn’t show on create presumably because all of the field values are null. I even tried forcing MyExt.Cache.AllowSelect = true; in the RowSelected event but that doesn’t work.

What did I miss?  Thanks.


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 16 replies
  • February 2, 2025

Closing, as my original issue was resolved.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings