Skip to main content
Question

Kit Assembly Scalar Field Contains no Value

  • February 6, 2024
  • 0 replies
  • 45 views

Hello,

I am trying to implement a scalar custom field within the Kit Assembly page. The target functionality of this field is to select a boolean value from a custom table. I have implemented this field on various other pages but copying over that code to this page has not worked out for me.

The following code is an example field I implemented on the Purchase Order page. This field is functioning as intended.

[PXBool]
[PXUIField(DisplayName = "Is Cool", Enabled = false)]
[PXDBScalar(typeof(Search<MyTable.isCool, Where<MyTable.docNbr, Equal<POOrder.orderNbr>, And<MyTable.docType, Equal<MyConstants.PurchDocType>>>>))]
public virtual bool? IsCool{ get; set; }
public abstract class isCool: Data.BQL.BqlBool.Field<isCool> { }

I used the Purchase Order example field as a template for the Kit Assembly page, making sure to update the WHERE filters, however the field does not seem to select data from my custom table and never contains a true value.

[PXBool]
[PXUIField(DisplayName = "Is Cool", Enabled = false)]
[PXDBScalar(typeof(Search<MyTable.isCool, Where<MyTable.docNbr, Equal<INKitRegister.refNbr>, And<MyTable.docType, Equal<MyConstants.KADocType>>>>))]
public virtual bool? IsCool{ get; set; }
public abstract class isCool: Data.BQL.BqlBool.Field<isCool> { }

I noticed the INKitRegister object may be a view or an aggregate of the INRegister table, so I tried updating the WHERE filters to use the INRegister object instead of INKitRegister. The issue persisted in this case.

I also tried joining the INRegister table with my custom table to retrieve the needed value, but this did not work out either.

[PXBool]
[PXUIField(DisplayName = "Is Cool", Enabled = false)]
[PXDBScalar(typeof(Search2<MyTable.isCool, InnerJoin<INRegister, On<MyTable.docNbr, Equal<INRegister.refNbr>>>, Where<MyTable.docType, Equal<MyConstants.KADocType>, And<INRegister.docType, Equal<MyConstants.KADocType>>>>))]
public virtual bool? IsCool{ get; set; }
public abstract class isCool: Data.BQL.BqlBool.Field<isCool> { }

Is there anything I am missing with implementing this field or is there anything I can do differently?

Thank you!