Skip to main content
Solved

PrimaryKeyOf does not contain a definition for BaseBy


Forum|alt.badge.img+1

Upgrading a customization project from 23R1 to 24R1 I’m getting the following error:

PrimaryKeyOf<MyDAC> does not contain a definition for BaseBy

Here’s the line of code.

PrimaryKeyOf<MyDAC>.BaseBy<MyDAC.field1, Config>.FindBy(graph, field1);

Is there a different namespace needed or has the BaseBy been removed.

 

Thanks

Scott

Best answer by palbores

@scottstanaland12 

 

This is for the Foreign Key.

 

public static class FK
{
  public class Country : 
 PX.Objects.CS.Country.PK.ForeignKeyOf<AHSVendorCoreAddress>.By<countryID>
  {
  }
}

 

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

4 replies

palbores
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • 41 replies
  • August 14, 2024

HI @scottstanaland12 

 

you can try this

 

public class PK : PrimaryKeyOf<DAC>.By<field>
   {
       public static DAC Find(PXGraph graph, DataTypeOfTheField field) => FindBy(graph, field);
   }

 


Forum|alt.badge.img+1

@palbores ,

 

Thanks! That worked.  I’m unsure how to update the foreign key definition in the following code.

 

I’m getting the same error related to the BaseBy

 

public static class FK
{


            public class Country : PrimaryKeyOf<PX.Objects.CS.Country>.BaseBy<PX.Objects.CS.Country.countryID, PrimaryKeyOf<PX.Objects.CS.Country>.By<PX.Objects.CS.Country.countryID>.Config>.ForeignKeyOf<AHSVendorCoreAddress>.By<countryID>
            {
            }
}

 


palbores
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • 41 replies
  • Answer
  • August 14, 2024

@scottstanaland12 

 

This is for the Foreign Key.

 

public static class FK
{
  public class Country : 
 PX.Objects.CS.Country.PK.ForeignKeyOf<AHSVendorCoreAddress>.By<countryID>
  {
  }
}

 


Forum|alt.badge.img+1

@palbores 

That did the trick, I’m past all my compile errors now.

Thanks for your help!


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