Skip to main content
Answer

PrimaryKeyOf does not contain a definition for BaseBy

  • August 14, 2024
  • 4 replies
  • 54 views

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>
{
}
}

 

4 replies

palbores
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • 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
  • 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!