Skip to main content

Using V2023R2 trying to retrieve quantities from INSiteStatus in a processing program.

Error:

 

Error is on the .Select line that is in red in the code shown below:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Diagnostics;
using PX.Data;
using PX.Objects;
using PX.Data.BQL.Fluent;
using PX.Data.BQL;
using PX.Data.ReferentialIntegrity.Attributes;
using static PX.Api.SYMapping;
using MCB_Custom.MspData;
using PX.Objects.IN;
using PX.Objects.SO;

namespace MCBCustom
{
    public class FixMSPDataAlloc : PXGraph<FixMSPDataAlloc>
    {

        public PXCancel<MSPDataResult> Cancel;
        public PXProcessing<MSPDataResult> ResultView;

        public FixMSPDataAlloc()
        {
            ResultView.SetProcessDelegate(ProcessFixMSPDataAlloc);
            ResultView.SetProcessCaption("");  // not used in this program
            ResultView.SetProcessAllCaption("Process All");
        }
        public static void ProcessFixMSPDataAlloc(List<MSPDataResult> importSettings)
        {
            InventoryItemMaint graph = PXGraph.CreateInstance<InventoryItemMaint>();

            PXResultset<InventoryItem, INSiteStatus, INSite> result = SelectFrom<InventoryItem>
                .InnerJoin<INSiteStatus>.On<InventoryItem.inventoryID.IsEqual<INSiteStatus.inventoryID>>
                .InnerJoin<INSite>.On<INSiteStatus.siteID.IsEqual<INSite.siteID>>
                .Where<InventoryItem.stkItem.IsEqual<@P.AsBool>
                .And<InventoryItem.itemStatus.IsEqual<@P.AsString>>>
                .Select(graph, true, "AC");

            foreach (PXResult<InventoryItem, INSiteStatus, INSite> record in result)
            {
                InventoryItem resItem = (InventoryItem)record;
                INSiteStatus resStatus = (INSiteStatus)record;
                INSite resSite = (INSite)record;

 

For F-bql, you need View.Select()


Thanks Daryl.  Now I am to a new error.

 


Try this:

var result = (PXResultset<InventoryItem, INSiteStatus, INSite>)SelectFrom<InventoryItem.InnerJoin<INSiteStatus>.On<InventoryItem.inventoryID.IsEqual<INSiteStatus.inventoryID>>.InnerJoin<INSite>.On<INSiteStatus.siteID.IsEqual<INSite.siteID>>.Where<InventoryItem.stkItem.IsEqual<@P.AsBool>.And<InventoryItem.itemStatus.IsEqual<@P.AsString>>>.View.Select(graph, true, "AC");


Perfect.  That worked.  Thank-you very much!


Fantastic. Could you mark that as the answer?


Sorry I clicked on the wrong part as best answer.  Not sure how to undo that and make the actually code reply as the best answer.


@Chris Hackett can


Ha, just realized who this is. Good to see you 😁


I got a chuckle out of you answering.  I am still working on how to split out a project for you.  Thanks for your help today.


I got a chuckle out of you answering.

It’s good marketing 😉

Happy to help!


I have fixed the best answer 😀


Reply