#c# #acumatica
#c# #acumatica
Вопрос:
У меня есть ЦАП проекции, определенный как показано ниже. Я использую этот ЦАП в представлении InventoryItemMaint
. Мне нужно InventoryID
, чтобы поле моего проекционного ЦАП по умолчанию соответствовало идентификатору текущего элемента, но ничего из того, что я пытаюсь, не работает.
Есть ли специальный способ сделать это?
Я пробовал:
PXDBDefault
с помощьюPXParent
PXDefault(typeof(InventoryItem.inventoryID))]
PXFormula
(как показано ниже)
[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
}
[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
}
Ответ №1:
Связываете ли вы свое представление с текущим свойством кэша в определении представления в расширении InventoryMaint graph? Что-то вроде
public PXSelect<MXItemNutrientValues,Where<MXItemNutrientValues.inventoryid, Equal<Current<InventoryItem.inventoryID>>> customView;
Комментарии:
1. Да, но
Where<MXItemNutrientValues.classID.IsEqual<InventoryItemExt.usrFormulaClassID.FromCurrent>>
2. Интересно, я знаю, что текущее свойство охватывает только базовый ЦАП представления. Возможно, это не включает расширения кэша.