Can't change combine DiscriptionField of Selector Stock Item
Hi,
I have a custom field named UserSearchName on Stock Item and I want to use this field to combine DescriptionField of seletor Inventory.
I updated the attribute DescriptionField of InventoryID to: PX.Objects.IN.InventoryItem+userSearchName
But I got the error regarding syntax I think, I have no idea what wrong here.
Do you have any experience about this one?
Any idea would be appreciate.
Thanks
Page 1 / 1
@mrthanhkhoi I don’t quite follow what you are trying to accomplish.
Are you looking to concatenate a new Usr field with the InventoryItem Description so that you can show the concatenation result in the DescriptionField of the PXSelectors?
Try to describe the expected functionality in the final result.
Hi @Fernando Amadoz, sorry for the ambiguous describe.
When I try to search Inventory in Sales Orders screen, the display name of selector InventoryID is combine between InventoryItem and description fields.
The goal is: display name when searching should be combined from InventoryItem and a new field (called: userSearchName)
@mrthanhkhoi
This is the original field definition
#region InventoryID public abstract class inventoryID : PX.Data.BQL.BqlInt.Field<inventoryID> { public class InventoryBaseUnitRule : InventoryItem.baseUnit.PreventEditIfExists< Select<SOLine, Where<inventoryID, Equal<Current<InventoryItem.inventoryID>>, And<lineType, In3<SOLineType.inventory, SOLineType.nonInventory>, And<completed, NotEqual<True>>>>>> { } } protected Int32? _InventoryID; SOLineInventoryItem(Filterable=true)] PXDefault()] PXForeignReference(typeof(FK.InventoryItem))] public virtual Int32? InventoryID { get { return this._InventoryID; } set { this._InventoryID = value; } } #endregion
The attribute >SOLineInventoryItem] includes the PXSelector definition, which is the one that manages the SubstituteKey and DescriptionField properties.
You could redefine that attribute in the following way:
Notice that the second to last parameter of the constructor implements InventoryItemExt.usrCustomField, instead of the original InventoryItem.descr
Then the field can be redefined in the SOOrderEntry graph via CacheAttached in order to use the new Attribute, instead of the original one:
public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry> { SOLineTESTInventoryItem(Filterable=true)] PXDefault()] public void SOLine_InventoryID_CacheAttached(PXCache sender) { } }
Result
Attached is a customization project example for additional references
@mrthanhkhoi were you able to implement the suggested approach from my last post?
Hi @Fernando Amadoz,
Thank you very much for your suggestion. I could change the combination of display name now.
In addition, My boss want to search by following fields:Search Name, InventoryID, English Name.
It means: if we input Energiner, it should show V-IL-00701 (same as image above) because its description contains “Energiner”
but I don’t know we could do it or not.
Do you have any idea?
@mrthanhkhoi as fas as I know, when the search is done from the field directly, only 2 fields can be used: the selector’s SubstituteKey and DescriptionField
However, you could try to use the FastFilterFields property in order to filter by additional columns, using the selector’s smartpanel.