Skip to main content
Question

Key Blanks after Entry

  • December 19, 2024
  • 4 replies
  • 44 views

Forum|alt.badge.img+1

I have created a DAC with two keys and an Identity field. I can view and edit existing records fine, however when I create a new record and enter in a new key value as soon as I leave the field it blanks. Both Key fields blank after I focus is lost.

Any Ideal? 

   [Serializable]
[PXCacheName("MLS Listing")]
[PXPrimaryGraph(typeof(MLSListingList))]
public class GPMLSListing : PXBqlTable, IBqlTable
{

public class PK : PrimaryKeyOf<GPMLSListing>.By<address1, postalCode>
{
public static GPMLSListing Find(PXGraph graph, string address1, string postalCode) => FindBy(graph, address1, postalCode);
}


#region ListingID
[PXDBIdentity( FieldName = "Property ID")]
//[PXSelector(typeof(Search<address1>), ValidateValue = false)]
public virtual int? ListingID { get; set; }
public abstract class listingID : PX.Data.BQL.BqlInt.Field<listingID> { }
#endregion

#region Selected
[PXBool]
[PXUIField(DisplayName = "Selected")]
public virtual bool? Selected { get; set; }
public abstract class selected : BqlType<IBqlBool, bool>.Field<selected> { }

#endregion

#region Address1
[PXDBString(50, IsKey = true, IsUnicode = true, InputMask = "")]
[PXDefault]
[PXUIField(DisplayName = "Address")]
//[PXCheckUnique(Where = typeof(Where<address1, Equal<Current<address1>>, And<postalCode, Equal<Current<postalCode>>>>))]
//[PXSelector(typeof(Search<address1>), ValidateValue = false)]
public virtual string Address1 { get; set; }
public abstract class address1 : PX.Data.BQL.BqlString.Field<address1> { }
#endregion

#region PostalCode
[PXDBString(20, IsKey = true)]
[PXUIField(DisplayName = "Zip")]
[PXZipValidation(typeof(Country.zipCodeRegexp), typeof(Country.zipCodeMask), typeof(country))]
//[PXSelector(typeof(Search<postalCode>), ValidateValue = false)]
[PXPersonalDataField]
public virtual string PostalCode { get; set; }
public abstract class postalCode : PX.Data.BQL.BqlString.Field<postalCode> { }
#endregion

#region City
[PXDBString(50, IsUnicode = true)]
[PXDefault]
[PXUIField(DisplayName = "City", Visibility = PXUIVisibility.SelectorVisible)]
public virtual string City { get; set; }
public abstract class city : PX.Data.BQL.BqlString.Field<city> { }
#endregion

#region State
[PXDBString(50, IsUnicode = true)]
[PXUIField(DisplayName = "State")]
[State(typeof(country))]
public virtual string State { get; set; }
public abstract class state : PX.Data.BQL.BqlString.Field<state> { }
#endregion
}

 

4 replies

darylbowman
Captain II
Forum|alt.badge.img+15
  • December 20, 2024

Is this a grid?

 


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • December 20, 2024

This is in a form, Is that applicable?


darylbowman
Captain II
Forum|alt.badge.img+15
  • December 20, 2024

Not to my original suggestion, no. I realized after I posted it that I was assuming it was a grid.

I’m guessing you’re trying to prevent duplicate addresses, but I would recommend not using an auto-generated key in the database and a different key in the DAC, UNLESS you choose to use a natural key (which I would recommend).


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • December 20, 2024

I tried without the ListingID and found the same issue.

My goal was to allow an imports scenario to insertOrReplace based off the keys of address or postalcode. But I am really struggling.

 

Leif