Solved

PXSelector not allowing to save Record (Section ID not found in the System).

  • 13 January 2022
  • 8 replies
  • 198 views

Userlevel 4
Badge +1

Hi, Good Morning All.

I have created a custom project and I am trying to add selector to the Section ID (section code) field.

But, it is not allowing me to save changes to the database. It gives me the error like the below:

Section ID not found in the System. Please find the attachment.

 

 

Thanks In Adavance.

Moulali shaik.

 

icon

Best answer by vivekm 13 January 2022, 08:23

View original

8 replies

Userlevel 4
Badge

Hi @MoulaliShaik79 

I too have a customization where I am using a selector field with similar details and attributes and that is working as expected for me.

Can you please share your DAC, Graph and aspx code pieces so we can verify with the same.

Userlevel 4
Badge +1

Hi @vivekm,

Hope you are doing good, please find the attachment.

 

 

Thanks,

Moulali Shaik.

Userlevel 7
Badge +17

Hi @MoulaliShaik79   Is Section ID field is KEY field?  If yes, please add attribute IsKey = True like below.

  #region IntegrationID

[PXDBString(30, IsKey = true, IsUnicode = true, InputMask = "")]
[PXDefault()]
[PXUIField(DisplayName = "Integration ID", Required = true)]
[PXSelector(typeof(Search<TestDAC.integrationID>), typeof(TestDAC.integrationID), typeof(TestDAC.description), typeof(TestDAC.integrationType))]
public virtual string IntegrationID { get; set; }
public abstract class integrationID : IBqlField { }

#endregion

 

Userlevel 4
Badge +1

Hi @Naveen B ,

Actually, Section ID is a primary key. I have renamed SectionCode UI field with “Section ID” label.

Please see the below DAC details.

 

 

 

 

Thanks,

Moulali Shaik.

Userlevel 4
Badge

Hi @MoulaliShaik79 

Please use below DAC fields and verify once, with these modifications it is working as expected:

 

  #region SectionID
    [PXDBIdentity()] //Removed IsKey property from here
    public virtual int? SectionID { get; set; }
    public abstract class sectionID : PX.Data.BQL.BqlInt.Field<sectionID> { }
    #endregion

    #region SectionCode
    [PXDBString(30, IsUnicode = true, InputMask = "", IsKey = true)] //Added IsKey property here
    [PXUIField(DisplayName = "Section ID")]
    [PXDefault]
    [PXSelector(typeof(Search<SSPAgreeSection.sectionCode>),
          typeof(SSPAgreeSection.sectionCode),
          typeof(SSPAgreeSection.descr),
          typeof(SSPAgreeSection.sectionType),
          typeof(SSPAgreeSection.printDescr))]
        public virtual string SectionCode { get; set; }
    public abstract class sectionCode : PX.Data.BQL.BqlString.Field<sectionCode> { }
        #endregion

 

In DB table you can mark SectionCode with Primary Key and SectionID also with Primary Key along with Identity Specification, this will work fine.

Userlevel 7
Badge +17

@MoulaliShaik79  Here is my suggestion. Hope this helps you.

  • Please remove the PXDBIdentity from DAC and database (it is not required)
  • You can make the SectionCode field as Key in DAC and database. and please find the updated DAC file here.
using System;
using PX.Data;

namespace SSS.SSP
{
[Serializable]
[PXCacheName("SSPAgreeSection")]
public class SSPAgreeSection : IBqlTable
{


#region SectionCode
[PXDBString(30, IskKey= true, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Section ID")]
[PXDefault]
[PXSelector(typeof(Search<SSPAgreeSection.sectionCode>),
typeof(SSPAgreeSection.sectionCode),
typeof(SSPAgreeSection.descr),
typeof(SSPAgreeSection.sectionType),
typeof(SSPAgreeSection.printDescr))]
public virtual string SectionCode { get; set; }
public abstract class sectionCode : PX.Data.BQL.BqlString.Field<sectionCode> { }
#endregion

#region SectionType
[PXDefault("H")]
[PXDBString(1, IsFixed = true, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Section Type")]
[PXStringList(
new string[]
{
Helper.Constant.Header,
Helper.Constant.Footer
},
new string[]
{
Helper.Messages.Header,
Helper.Messages.Footer
})]
public virtual string SectionType { get; set; }
public abstract class sectionType : PX.Data.BQL.BqlString.Field<sectionType> { }
#endregion

#region Descr
[PXDefault]
[PXDBString(256, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Descr")]
public virtual string Descr { get; set; }
public abstract class descr : PX.Data.BQL.BqlString.Field<descr> { }
#endregion

#region PrintDescr
[PXDefault(true)]
[PXDBBool()]
[PXUIField(DisplayName = "Print Descr")]
public virtual bool? PrintDescr { get; set; }
public abstract class printDescr : PX.Data.BQL.BqlBool.Field<printDescr> { }
#endregion

#region NoteHtml
[PXDefault]
[PXDBString(IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Note Html")]
public virtual string NoteHtml { get; set; }
public abstract class noteHtml : PX.Data.BQL.BqlString.Field<noteHtml> { }
#endregion

#region Tstamp
[PXDBTimestamp()]
[PXUIField(DisplayName = "Tstamp")]
public virtual byte[] Tstamp { get; set; }
public abstract class tstamp : PX.Data.BQL.BqlByteArray.Field<tstamp> { }
#endregion

#region CreatedByID
[PXDBCreatedByID()]
public virtual Guid? CreatedByID { get; set; }
public abstract class createdByID : PX.Data.BQL.BqlGuid.Field<createdByID> { }
#endregion

#region CreatedByScreenID
[PXDBCreatedByScreenID()]
public virtual string CreatedByScreenID { get; set; }
public abstract class createdByScreenID : PX.Data.BQL.BqlString.Field<createdByScreenID> { }
#endregion

#region CreatedDateTime
[PXDBCreatedDateTime()]
public virtual DateTime? CreatedDateTime { get; set; }
public abstract class createdDateTime : PX.Data.BQL.BqlDateTime.Field<createdDateTime> { }
#endregion

#region LastModifiedByID
[PXDBLastModifiedByID()]
public virtual Guid? LastModifiedByID { get; set; }
public abstract class lastModifiedByID : PX.Data.BQL.BqlGuid.Field<lastModifiedByID> { }
#endregion

#region LastModifiedByScreenID
[PXDBLastModifiedByScreenID()]
public virtual string LastModifiedByScreenID { get; set; }
public abstract class lastModifiedByScreenID : PX.Data.BQL.BqlString.Field<lastModifiedByScreenID> { }
#endregion

#region LastModifiedDateTime
[PXDBLastModifiedDateTime()]
public virtual DateTime? LastModifiedDateTime { get; set; }
public abstract class lastModifiedDateTime : PX.Data.BQL.BqlDateTime.Field<lastModifiedDateTime> { }
#endregion

#region Noteid
[PXNote()]
public virtual Guid? Noteid { get; set; }
public abstract class noteid : PX.Data.BQL.BqlGuid.Field<noteid> { }
#endregion
}
}

 

Userlevel 4
Badge +1

Hi @vivekm  and @Naveen B 

Thanks a lot both of you. Now I am able to save it.

 

 

 

Thanks,

Moulali Shaik.

Userlevel 4
Badge

@MoulaliShaik79 happy to help :slight_smile:

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved