Hi, I have a requirement where the values entered in the Attributes form need to be pulled into a custom form I make. So, I basically need a way to have a custom line level drop-down list field which contains all the values that are previously entered in the Attributes form. Any help regarding this would be appreciated.
Get Attribute Values from Attributes form to Custom Line Level Field
Hi
Hi
public virtual void DACName_FieleName_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
List<string> allowedValues = new List<string>();
foreach (CSAttributeDetail objCSAttributeDetail in PXSelect<CSAttributeDetail,
Where<CSAttributeDetail.attributeID, Equal<Required<CSAttributeDetail.attributeID>> >>.Select(Base, "PKGOPTIONS"));
{
allowedValues.Add(objCSAttributeDetail.Description);
}
e.ReturnState = PXStringState.CreateInstance(e.ReturnState, 10, true, typeof(DACName.FieldName).Name, false, -1, string.Empty, allowedValues.ToArray(), allowedValues.ToArray(), false, null);
}
Hi,
public virtual void DACName_FieleName_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
List<string> allowedValues = new List<string>();
foreach (CSAttributeDetail objCSAttributeDetail in PXSelect<CSAttributeDetail,
Where<CSAttributeDetail.attributeID, Equal<Required<CSAttributeDetail.attributeID>> >>.Select(this, "PKGOPTIONS"));
{
allowedValues.Add(objCSAttributeDetail.Description);
}
e.ReturnState = PXStringState.CreateInstance(e.ReturnState, 10, true, typeof(DACName.FieldName).Name, false, -1, string.Empty, allowedValues.ToArray(), allowedValues.ToArray(), false, null);
}
Hi
eg- Select Option 1 → one field appears in my tab item
Select Option 2 → different field appears in my tab item
-- Based on the selection of “Packaging type” you need to enable the fields right?
If this is your requirement, yes please have enable/disable logic in RowSelected Event
Yes
protected virtual void PKCFPackagingOption_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
PKCFPackagingOption row = e.Row as PKCFPackagingOption;
if (row == null) return;
if(row != null)
{
CSAttributeDetail attributeID = PXSelect<CSAttributeDetail, Where<CSAttributeDetail.attributeID, Equal<Required<CSAttributeDetail.attributeID>>>>.Select(this, "PKGOPTIONS");
CSAttributeDetail valueID = PXSelect<CSAttributeDetail, Where<CSAttributeDetail.valueID, Equal<Required<CSAttributeDetail.valueID>>>>.Select(this, "Option01");
if(attributeID.Equals("PKGOPTIONS") && valueID.Equals("Option01"))
{
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBLength>(cache, null, false);
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBWidth>(cache, null, false);
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBHeight>(cache, null, false);
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBNettWeight>(cache, null, false);
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBGrossWeight>(cache, null, false);
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBPerCarton>(cache, null, false);
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBStickerDetails>(cache, null, false);
}
}
}
Hi
Hi
- It is NOT recommended to write a BQLs in RowSelected event ***. This code will slow down performance of that screen.
- Also, you are retrieving all the records from CSAttributeDetail table instead of specific record
- I’m assuming that Attribute value will be available in row extension and take the value from row and check (valueID == "Option01”) instead of writing the BQL queries and based on the you can have enable/disable logic in place.
Hi
Sample Code..
protected virtual void PKCFPackagingOption_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
PKCFPackagingOption row = e.Row as PKCFPackagingOption;
if (row == null) return;
if (row != null)
{
//CSAttributeDetail attributeID = PXSelect<CSAttributeDetail, Where<CSAttributeDetail.attributeID, Equal<Required<CSAttributeDetail.attributeID>>>>.Select(this, "PKGOPTIONS");
//CSAttributeDetail valueID = PXSelect<CSAttributeDetail, Where<CSAttributeDetail.valueID, Equal<Required<CSAttributeDetail.valueID>>>>.Select(this, "Option01");
PKCFPackagingOption rowExt = row.GetExtension<PKCFPackagingOption>();
if (rowExt.valueID == "Option01")
{
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBLength>(cache, null, rowExt.valueID == "Option01");
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBWidth>(cache, null, rowExt.valueID == "Option01");
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBHeight>(cache, null, rowExt.valueID == "Option01");
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBNettWeight>(cache, null, rowExt.valueID == "Option01");
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBGrossWeight>(cache, null, rowExt.valueID == "Option01");
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBPerCarton>(cache, null, rowExt.valueID == "Option01");
PXUIFieldAttribute.SetVisible<PKCFPackagingOption.gBStickerDetails>(cache, null, rowExt.valueID == "Option01");
}
}
}
Hi,
Best Regards,
Tharidhi
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.