public virtual string UsrItemClass { get; set; } public abstract class usrItemClass : PX.Data.BQL.BqlString.Field<usrItemClass> { } #endregion }
When I tried creating the field in Customization Project Editor screen, it seems like it was created in two places: StoragePlace and StoragePlaceStatus.
However, referring from the Element Inspector in Storage Summary screen, it is referring to only StoragePlaceStatus. Am I missing anything here?
Page 1 / 1
Hi,
As you try to extend DAC table that uses PXProjection] attribute, it can be difficult to select data using PXScalar or PXFormula from DB, but it is real.
I think PXDependsOnField you can delete from code, I don’t try building code without it, but anyway it works as on screen-shot below.
Hi @andriikravetskyi35 , thanks for your response. The code works like a charm!
However, my end result is a bit different from yours despite running the same code as indicated above.
As you can see, my item class doesn’t show the description whereas yours does show it. Any ideas why?
@andriikravetskyi35
if you comment the below part of the DAC Ext you should get your desired result in the grid
SubstituteKey = typeof(INItemClass.itemClassCD),
alternatively I guess there is property that you can choose for the field in the grid whether value or text should be displayed if I’m not mistaken
For description in selector in one field, yes, we use SubstituteKey and Description field, and also preferences on aspx file.
You need setup “DisplayMode” and select Hint in customization editor, here is example:
Both of you are right! I’ve changed the DisplayMode to Hint and it shows both Value and Text. Thanks a lot for this, really appreciate it!
Hi @andriikravetskyi35 & @aaghaei ,
It seems like 2023 R2 renders the code useless now - the Item Class column does not populate any value. I’ve tried alternatives such as:
Calling a FieldUpdated event on Warehouse filter - the filter will be defaulted to blank again
Reverted back to using PXDBScalar - Item Class column remains blank
However, both alternatives, as indicated above, does not work. Can anyone explain on why this happened and what other alternatives can I explore for this issue?
Hi, @ericklasimin61
Here DAC and Graph extensions, I change type of custom field from string to int, also add one event, and it works without attributes in DAC:
public class StoragePlaceStatusExt : PXCacheExtension<PX.Objects.IN.StoragePlaceStatus> { public static bool IsActive() => true;
#region UsrItemClass [PXInt()] [PXUIField(DisplayName = "Item Class")] [PXSelector(typeof(SearchFor<INItemClass.itemClassID>), SubstituteKey =typeof(INItemClass.itemClassCD), DescriptionField =typeof(INItemClass.descr))] public virtual int? UsrItemClass { get; set; } public abstract class usrItemClass : PX.Data.BQL.BqlInt.Field<usrItemClass> { } #endregion }
public class StoragePlaceEnqExt : PXGraphExtension<StoragePlaceEnq> { public static bool IsActive() => true;
SetValueExt and e.ReturnValue - use both commands, in another way you will see only ItemClassCD on screen.
Screen shots of aspx and UI:
Hi @andriikravetskyi35 , the code works like a charm!
That’s kinda odd since previously, it works without the needs to trigger the event. And may I further ask on how does FieldSelecting logic work when the targeted field for the event is the usrItemClass itself? I was under the impression that the trigger must be interacted with for the event to take place.
For example, if I have a custom field in SOLine, I will usually insert FieldUpdated event on SOLine.InventoryID so that upon inserting the line, the custom field will be populated.
@andriikravetskyi35 Upon further testing, it seems like we are unable to filter any values from the generated column. I’ve tried pulling the other generated columns as well, but apparently they cannot be filtered as well. Any workaround for this?
hi @ericklasimin61 ,
idea with event was more efficient in prospective of performance, but as filtering isn’t working, I override delegate of view.
So try to run this, except event, on my local PC filtering start working:
rPXOverride] public virtual IEnumerable Storages(Func<IEnumerable> baseMethod) { var rows = baseMethod();
foreach (StoragePlaceStatus row in rows) { var item = InventoryItem.PK.Find(Base, row.InventoryID);
var rowExt = PXCache<StoragePlaceStatus>.GetExtension<StoragePlaceStatusExt>(row); rowExt.UsrItemClass = item.ItemClassID; }
return rows; }
Hi @andriikravetskyi35 , the solution you provided works with the exception that the filtering only works for the current page.
However, I did manage to work around it by setting the AdjustPageSize to None and the PageSize to a value that is able to accommodate all of the records. So, at the end of the day, the issue is pretty much solved! Thanks a lot for your assistance, @andriikravetskyi35 !