I have a projection DAC defined as below. I am using this DAC in a view on InventoryItemMaint
. I need the InventoryID
field of my projection DAC to default to the current item's ID, but nothing I try works.
Is there a special way to do this?
I've tried:
PXDBDefault
with PXParent
PXDefault(typeof(InventoryItem.inventoryID))]
PXFormula
(like below) [PXProjection(typeof(SelectFrom<MXFormulaClass>.InnerJoin<MXFormulaClassNutrients>.
On<MXFormulaClassNutrients.classID.IsEqual<MXFormulaClass.classID>>.
LeftJoin<MXNutrientValue>.
On<MXNutrientValue.nutrientID.IsEqual<MXFormulaClassNutrients.nutrientID>>), Persistent = true)]
[PXCacheName("MXItemNutrientValues")]
public class MXItemNutrientValues : IBqlTable
{
#region ClassID
[PXDBInt(IsKey = true, BqlField = typeof(MXFormulaClassNutrients.classID))]
[PXUIField(DisplayName = "Class ID")]
public virtual int? ClassID { get; set; }
public abstract class classID : PX.Data.BQL.BqlInt.Field<classID> { }
#endregion
#region NutrientID
[PXDBInt(IsKey = true, BqlField = typeof(MXFormulaClassNutrients.nutrientID))]
[PXExtraKey]
[PXDBDefault(typeof(MXFormulaClassNutrients.nutrientID))]
[PXSelector(typeof(MXNutrient.nutrientID),
typeof(MXNutrient.nutrientCD),
typeof(MXNutrient.description),
SubstituteKey = typeof(MXNutrient.nutrientCD),
DescriptionField = typeof(MXNutrient.description))]
[PXUIField(DisplayName = "Nutrient")]
public virtual int? NutrientID { get; set; }
public abstract class nutrientID : PX.Data.BQL.BqlInt.Field<nutrientID> { }
#endregion
#region MinMax
[PXDBInt(IsKey = true, BqlField = typeof(MXFormulaClassNutrients.minMax))]
[PXIntList(new int[] { 1, 2 }, new string[] { "Min", "Max" })]
[PXUIField(DisplayName = "Min/Max")]
public virtual int? MinMax { get; set; }
public abstract class minMax : PX.Data.BQL.BqlInt.Field<minMax> { }
#endregion
#region SortOrder
[PXDBInt(BqlField = typeof(MXFormulaClassNutrients.sortOrder))]
[PXUIField(DisplayName = "Sort Order")]
public virtual int? SortOrder { get; set; }
public abstract class sortOrder : PX.Data.BQL.BqlInt.Field<sortOrder> { }
#endregion
#region InventoryID
[PXDBInt(IsKey = true, BqlField = typeof(MXNutrientValue.inventoryID))]
[PXFormula(typeof(Where<InventoryItem.inventoryID, Equal<Current<InventoryItem.inventoryID>>>))]
[PXUIField(DisplayName = "Inventory ID")]
public virtual int? InventoryID { get; set; }
public abstract class inventoryID : PX.Data.BQL.BqlInt.Field<inventoryID> { }
#endregion
#region Value
[PXDBDecimal(BqlField = typeof(MXNutrientValue.value))]
[PXUIField(DisplayName = "Value")]
public virtual Decimal? Value { get; set; }
public abstract class value : PX.Data.BQL.BqlDecimal.Field<value> { }
#endregion
#region CreatedByID
[PXDBCreatedByID(BqlField = typeof(MXNutrientValue.createdByID))]
public virtual Guid? CreatedByID { get; set; }
public abstract class createdByID : PX.Data.BQL.BqlGuid.Field<createdByID> { }
#endregion
#region CreatedByScreenID
[PXDBCreatedByScreenID(BqlField = typeof(MXNutrientValue.createdByScreenID))]
public virtual string CreatedByScreenID { get; set; }
public abstract class createdByScreenID : PX.Data.BQL.BqlString.Field<createdByScreenID> { }
#endregion
#region CreatedDateTime
[PXDBCreatedDateTime(BqlField = typeof(MXNutrientValue.createdDateTime))]
public virtual DateTime? CreatedDateTime { get; set; }
public abstract class createdDateTime : PX.Data.BQL.BqlDateTime.Field<createdDateTime> { }
#endregion
#region LastModifiedByID
[PXDBLastModifiedByID(BqlField = typeof(MXNutrientValue.lastModifiedByID))]
public virtual Guid? LastModifiedByID { get; set; }
public abstract class lastModifiedByID : PX.Data.BQL.BqlGuid.Field<lastModifiedByID> { }
#endregion
#region LastModifiedByScreenID
[PXDBLastModifiedByScreenID(BqlField = typeof(MXNutrientValue.lastModifiedByScreenID))]
public virtual string LastModifiedByScreenID { get; set; }
public abstract class lastModifiedByScreenID : PX.Data.BQL.BqlString.Field<lastModifiedByScreenID> { }
#endregion
#region LastModifiedDateTime
[PXDBLastModifiedDateTime(BqlField = typeof(MXNutrientValue.lastModifiedDateTime))]
public virtual DateTime? LastModifiedDateTime { get; set; }
public abstract class lastModifiedDateTime : PX.Data.BQL.BqlDateTime.Field<lastModifiedDateTime> { }
#endregion
#region Tstamp
[PXDBTimestamp(BqlField = typeof(MXNutrientValue.tstamp))]
public virtual byte[] Tstamp { get; set; }
public abstract class tstamp : PX.Data.BQL.BqlByteArray.Field<tstamp> { }
#endregion
#region Noteid
[PXNote(BqlField = typeof(MXNutrientValue.noteid))]
public virtual Guid? Noteid { get; set; }
public abstract class noteid : PX.Data.BQL.BqlGuid.Field<noteid> { }
#endregion
}
Are you linking your view to the Current property of the cache in the view definition in the InventoryMaint graph extension? Something like
public PXSelect<MXItemNutrientValues,Where<MXItemNutrientValues.inventoryid, Equal<Current<InventoryItem.inventoryID>>> customView;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.