Reputation: 67
I'm trying to use PXSelect to pull a value that's specific to an item and warehouse. I think I've tried every combination and I'm certain that I'm just missing some formatting.
The following code works, but doesn't add a filter for SiteID, which is what I need.
INItemSite TheItemSite = PXSelect<INItemSite, Where<INItemSite.inventoryID, Equal<Required<INItemSite.inventoryID>>>>.Select(Base, TheRow.InventoryID);
Upvotes: 0
Views: 387
Reputation: 7706
You need to add an "and" with the condition on SiteID like below:
INItemSite TheItemSite = PXSelect<INItemSite, Where<INItemSite.inventoryID, Equal<Required<INItemSite.inventoryID>>,
And<INItemSite.siteID,Equal<Required<INItemSite.siteID>>>>>.Select(Base, inventoryID,siteID);
Another way to get the record by keys will be to use the PK
of the record.
Below is the PK
of the INItemSite
.
public class PK : PrimaryKeyOf<INItemSite>.By<INItemSite.inventoryID, INItemSite.siteID>
{
public static INItemSite Find(PXGraph graph, int? inventoryID, int? siteID)
{
return PrimaryKeyOf<INItemSite>.By<INItemSite.inventoryID, INItemSite.siteID>.FindBy(graph, inventoryID, siteID);
}
}
You can write selects by Primary Key like below:
INItemSite record = INItemSite.PK.Find(graph, inventoryID, siteID);
Upvotes: 1