Skip to content

Instantly share code, notes, and snippets.

Avatar

Joshua Van Hoesen jvanhoesen

View GitHub Profile
@jvanhoesen
jvanhoesen / GetExtensions.cs
Created Jun 2, 2021
Retrieves slot of type PXCacheExtensionCollection
View GetExtensions.cs
public static PXCacheExtension[] GetExtensions(TNode row)
{
object pxCacheExtensionCollection = AAReflectionHelper.InvokeMethod(PXCacheExtensionCollectionType, null, "GetSlot", PXCacheExtensionCollectionType, new Type[0], new object[] { true });
object syncRoot = ((ICollection)pxCacheExtensionCollection).SyncRoot;
PXCacheExtension[] extensions;
IDictionary<IBqlTable, PXCacheExtension[]> dict = pxCacheExtensionCollection as IDictionary<IBqlTable, PXCacheExtension[]>;
lock (syncRoot)
{
@jvanhoesen
jvanhoesen / SelectRecords.cs
Created Jun 2, 2021
Selects DACs from the database including Extension fields
View SelectRecords.cs
public static IEnumerable<TNode> SelectRecords(params PXDataField[] restricts)
{
//Retrieves table structure for specified TNode
TableHeader tableStructure = PXDatabase.GetTableStructure(typeof(TNode).Name);
//Should be null if there's no Table, IE if you're using a Synthetic DAC
if (tableStructure != null)
{
List<PXDataField> parameters = new List<PXDataField>();
IEnumerable<PXDataRecord> selectDel = null;
@jvanhoesen
jvanhoesen / Project.xml
Created Apr 13, 2021
Customization Project XML
View Project.xml
<Sql TableName="Table1" TableSchemaXml="#CDATA">
<CDATA name="TableSchemaXml"><![CDATA[<table name="Table1">
<col name="Field1" type="Int" default="Zero" />
<col name="Field2" type="NVarChar(10)" />
<index name="PK_Table1" clustered="true" primary="true" unique="true">
<col name="Field1" />
<col name="Field2" />
</index>
</table>]]></CDATA>
</Sql>