Reputation: 25
I'm having an issue with a three-part screen that I've created. The screen has PMProject.ContractCD as a selector at the top and PMTran related to it on ProjectID in a graph below. In the second graph is a custom graph related to PMTran on TranID. It looks like this
The error that I am having happens when I enter a new line on the bottom graph, if I select another row before saving, the selected row is deleted when it saves the newly entered row. If I do not select another line before saving the whole thing saves just fine. Example
Here is the ASPX for the page:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/FormDetail.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="GR300000.aspx.cs" Inherits="Page_GR300000" Title="Untitled Page" %>
<%@ Mast erType VirtualPath="~/MasterPages/FormDetail.master" %>
<asp:Content ID="cont1" ContentPlaceHolderID="phDS" Runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%"
TypeName="GrantAmount.GrantAmountEntry"
PrimaryView="Project">
</px:PXDataSource>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phF" Runat="Server">
<px:PXFormView SyncPosition="True" SkinID="Transparent" ID="form" runat="server" DataSourceID="ds" DataMember="Project" Width="100%" Height="30%" AllowAutoHide="false">
<Template>
<px:PXLayoutRule ID="PXLayoutRule1" runat="server" StartRow="True"></px:PXLayoutRule>
<px:PXSegmentMask runat="server" ID="CstPXSegmentMask28" DataField="ContractCD" /></Template>
<CallbackCommands>
<Refresh RepaintControlsIDs="grid" CommitChanges="True" ></Refresh></CallbackCommands></px:PXFormView>
</asp:Content>
<asp:Content ID="cont3" ContentPlaceHolderID="phG" Runat="Server">
<px:PXGrid SyncPosition="True" KeepPosition="True" ID="grid" runat="server" DataSourceID="ds" Width="100%" Height="25 px" SkinID="Details" AllowAutoHide="false">
<Levels>
<px:PXGridLevel DataMember="PMTranView">
<Columns>
<px:PXGridColumn DataField="BAccountID" Width="120" ></px:PXGridColumn>
<px:PXGridColumn DataField="OrigTranType" Width="70" ></px:PXGridColumn>
<px:PXGridColumn DataField="Date" Width="90" ></px:PXGridColumn>
<px:PXGridColumn DataField="RefNbr" Width="70" ></px:PXGridColumn>
<px:PXGridColumn DataField="SubID" Width="120" ></px:PXGridColumn>
<px:PXGridColumn DataField="Description" Width="200" ></px:PXGridColumn>
<px:PXGridColumn DataField="Amount" Width="100" ></px:PXGridColumn>
<px:PXGridColumn DataField="TranID" Width="70" ></px:PXGridColumn>
<px:PXGridColumn DataField="ProjectID" Width="70" ></px:PXGridColumn>
<px:PXGridColumn DataField="ProjectID_description" Width="200" ></px:PXGridColumn></Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Container="Window" Enabled="True" MinHeight="150" ></AutoSize>
<ActionBar >
</ActionBar>
<AutoCallBack Target="CstPXGrid1" Command="Refresh" ActiveBehavior="True" >
<Behavior RepaintControlsIDs="CstPXGrid1" /></AutoCallBack></px:PXGrid>
<px:PXGrid DataSourceID="ds" Width="100%" SkinID="Details" Height="100 px" runat="server" ID="CstPXGrid1">
<Levels>
<px:PXGridLevel DataMember="GrantAmountsView" >
<Columns>
<px:PXGridColumn DataField="GrantID" Width="70" ></px:PXGridColumn>
<px:PXGridColumn DataField="Amount" Width="100" ></px:PXGridColumn>
<px:PXGridColumn DataField="Tranid" Width="70" ></px:PXGridColumn></Columns>
</px:PXGridLevel></Levels>
<ActionBar><Actions><Save Enabled="true" /></Actions></ActionBar>
</px:PXGrid></asp:Content>
C#:
using System;
using PX.Data;
using GrantTrackingTables;
using PX.Objects.PM;
using PX.Objects.CR;
using PX.Data.EP;
using PX.Objects.GL;
using PX.Objects.CM;
using PX.Common;
namespace GrantAmount
{
public class GrantAmountEntry : PXGraph<GrantAmountEntry>
{
#region Constants
public class string_CIP : Constant<string>
{
public string_CIP()
: base("CIP")
{
}
}
#endregion
#region Views
public PXSave<PMProject> Save;
public PXDelete<PMProject> Delete;
public PXCancel<PMProject> Cancel;
public PXFirst<PMProject> First;
public PXPrevious<PMProject> Previous;
public PXNext<PMProject> Next;
public PXLast<PMProject> Last;
public PXSelect<PMProject, Where<PMProject.baseType, Equal<PMProject.ProjectBaseType>,
And<PMProject.isTemplate, Equal<False>>>> Project;
public PXSelectJoin<PMTran,
InnerJoin<PMTask, On<PMTask.projectID, Equal<PMTran.projectID>,
And<PMTask.taskCD, Equal<string_CIP>, And<PMTran.projectID,
Equal<Current<PMProject.contractID>>>>>>> PMTranView;
public PXSelect<GrantAmounts, Where<GrantAmounts.tranid, Equal<Current<PMTran.tranID>>>> GrantAmountsView;
#endregion
}
}
Not too complex, but obviously I'm missing something here, probably with the way the views are related together?
Edit: GrantAmounts DAC:
using System;
using PX.Data;
namespace GrantTrackingTables
{
[Serializable]
public class GrantAmounts: IBqlTable
{
#region GrantID
public class grantID : IBqlField{}
[PXDBString(9, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCC")]
[PXSelector(typeof(Search<Grants.grantID, Where<Grants.isActive, Equal<True>>>), typeof(Grants.grantDesc))]
[PXUIField(DisplayName = "Grant ID")]
public string GrantID { get; set; }
#endregion
#region Amount
public class amount : IBqlField{}
[PXDBDecimal(2)]
[PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Amount")]
public decimal? Amount { get; set; }
#endregion
#region Tranid
[PXDBLong(IsKey = true)]
[PXUIField(DisplayName = "Tranid", Visible = true)]
public long? Tranid { get; set; }
public class tranid : IBqlField{}
#endregion
}
}
Grants DAC:
using System;
using PX.Data;
namespace GrantTrackingTables
{
[Serializable]
public class Grants: IBqlTable
{
#region GrantID
[PXDBString(9, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCC")]
[PXUIField(DisplayName = "Grant ID")]
public string GrantID { get; set; }
public class grantID : IBqlField{}
#endregion
#region GrantDesc
[PXDBString(40, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Grant Desc")]
public string GrantDesc { get; set; }
public class grantDesc : IBqlField{}
#endregion
#region IsActive
[PXDBBool]
[PXDefault(true)]
[PXUIField(DisplayName = "Is Active")]
public bool? IsActive { get; set; }
public class isActive : IBqlField{}
#endregion
#region CreatedByID
[PXDBCreatedByID()]
public Guid? CreatedByID { get; set; }
public class createdByID : IBqlField { }
#endregion
#region CreatedByScreenID
[PXDBCreatedByScreenID()]
public string CreatedByScreenID { get; set; }
public class createdByScreenID : IBqlField { }
#endregion
#region CreatedDateTime
[PXDBCreatedDateTime()]
public DateTime? CreatedDateTime { get; set; }
public class createdDateTime : IBqlField { }
#endregion
#region LastModifiedByID
[PXDBLastModifiedByID()]
public Guid? LastModifiedByID { get; set; }
public class lastModifiedByID : IBqlField { }
#endregion
#region LastModifiedByScreenID
[PXDBLastModifiedByScreenID()]
public string LastModifiedByScreenID { get; set; }
public class lastModifiedByScreenID : IBqlField { }
#endregion
#region LastModifiedDateTime
[PXDBLastModifiedDateTime()]
public DateTime? LastModifiedDateTime { get; set; }
public class lastModifiedDateTime : IBqlField { }
#endregion
}
}
Call Stack from RowDeleted:
RuntimeCode_6E630598B291BE5.dll!GrantAmount.GrantAmountEntry.GrantAmounts_RowDeleted(PX.Data.PXCache sender, PX.Data.PXRowDeletedEventArgs e, PX.Data.PXRowDeleted del) Line 41
PX.Data.dll!PX.Data.PXCache.OnRowDeleted(object item, bool externalCall)
PX.Data.dll!PX.Data.PXCache<GrantTrackingTables.GrantAmounts>.Delete(System.Collections.IDictionary keys, System.Collections.IDictionary values)
PX.Data.dll!PX.Data.PXGraph.ExecuteDelete(string viewName, System.Collections.IDictionary keys, System.Collections.IDictionary values, object[] parameters)
PX.Web.UI.dll!PX.Web.UI.PXBaseDataSource.ExecuteDelete(string viewName, System.Collections.IDictionary keys, System.Collections.IDictionary oldValues)
System.Web.dll!System.Web.UI.DataSourceView.Delete(System.Collections.IDictionary keys, System.Collections.IDictionary oldValues, System.Web.UI.DataSourceViewOperationCallback callback)
PX.Web.UI.dll!PX.Web.UI.PXGrid.PerformDelete(System.Collections.Specialized.IOrderedDictionary keys, System.Collections.Specialized.IOrderedDictionary oldValues)
PX.Web.UI.dll!PX.Web.UI.PXGrid.af()
PX.Web.UI.dll!PX.Web.UI.PXGrid.ah()
PX.Web.UI.dll!PX.Web.UI.PXGrid.System.Web.UI.IPostBackDataHandler.LoadPostData(string key, System.Collections.Specialized.NameValueCollection postCollection)
PX.Web.UI.dll!PX.Web.UI.PXPage.a(System.Web.UI.ControlCollection A_0, System.Collections.Specialized.NameValueCollection A_1, System.Collections.ArrayList A_2)
PX.Web.UI.dll!PX.Web.UI.PXPage.a(System.Web.UI.ControlCollection A_0, System.Collections.Specialized.NameValueCollection A_1, System.Collections.ArrayList A_2)
PX.Web.UI.dll!PX.Web.UI.PXPage.a(System.Web.UI.ControlCollection A_0, System.Collections.Specialized.NameValueCollection A_1, System.Collections.ArrayList A_2)
PX.Web.UI.dll!PX.Web.UI.PXPage.a(System.Web.UI.ControlCollection A_0, System.Collections.Specialized.NameValueCollection A_1, System.Collections.ArrayList A_2)
PX.Web.UI.dll!PX.Web.UI.PXPage.a(System.Web.UI.ControlCollection A_0, System.Collections.Specialized.NameValueCollection A_1, System.Collections.ArrayList A_2)
PX.Web.UI.dll!PX.Web.UI.PXPage.OnPreLoad(System.EventArgs e)
System.Web.dll!System.Web.UI.Page.ProcessRequestMain(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint)
System.Web.dll!System.Web.UI.Page.ProcessRequest(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint)
System.Web.dll!System.Web.UI.Page.ProcessRequest()
System.Web.dll!System.Web.UI.Page.ProcessRequest(System.Web.HttpContext context)
PX.Web.UI.dll!PX.Web.UI.PXPage.ProcessRequest(System.Web.HttpContext context)
App_Web_eesmr4wd.dll!ASP.cstpublished_pages_gr_gr300000_aspx.ProcessRequest(System.Web.HttpContext context)
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
System.Web.dll!System.Web.HttpApplication.ExecuteStepImpl(System.Web.HttpApplication.IExecutionStep step)
System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously)
System.Web.dll!System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Exception error)
System.Web.dll!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext context, System.AsyncCallback cb)
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
[Native to Managed Transition]
[Managed to Native Transition]
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
[AppDomain Transition]
Upvotes: 1
Views: 267
Reputation: 8278
PXDBString(IsUnicode = true) maps to database type nvarchar, type with prefix 'n' like 'nchar' and 'nvarchar' should be use when IsUnicode = true.
Type 'char' should be used when IsFixed = true. Type 'varchar' when IsFixed = false because 'var' means variable as in not fixed. Usually IsFixed property is omitted as this is the default value.
Having mismatch types is known to cause slight issues so you should double check that when you're experiencing weird database persisting glitches.
Upvotes: 2