BAQDataView not pulling data

I am working on adding an UltraGrid to OrderEntry so that users can see the ShipTo Salesreps (That way they do not have to search them up everytime to enter salespersons). I was going to have the combo boxes for the salesperson default but it was too difficult to fight Epicor’s built-in logic. Currently, I have a BAQDataView that I would like it subscribed to the CustID entered so that they only see the customer information they need. When I enter a customer, no data appears.

	public void CreateBAQView()
	{
		baq2063 = new BAQDataView("2063");
		oTrans.Add("CustTerritoryBAQ", baq2063);
		
		string pubBinding = "OrderHed.CustomerCustID";
		IPublisher pub = oTrans.GetPublisher(pubBinding);
		if(pub == null)
		{
			oTrans.PublishColumnChange(pubBinding, "MyCustomPublish");
			pub = oTrans.GetPublisher(pubBinding);
		}

		if(pub != null)
			baq2063.SubscribeToPublisher(pub.PublishName, "Customer_CustID");
	}


This isnt the final BAQ I want to use. I am just trying to see how this would work. It is pulling the right BAQ and the correct columns pull up but no data comes out. When I filter the BAQ in the designer for the same customer I get a few rows. I am hoping this is just a simple error somewhere?

Thanks,
Jakob

What is the name of your BAQ?

Shouldn’t the first two lines be the following?

baq2063 = new BAQDataView("CustTerritoryBAQ");
oTrans.Add("baq2063", baq2063);

The name of the BAQ is 2063. Our company uses numbers to identify BAQs.

Then to me your code looks ok. Maybe try Customer.CustNum to broadcast? As long as it’s in your BAQ that should work.

Hm. Something seems off. I tried CustNum as a publisher/subscriber, but that didn’t work.

Then I tried just commenting out the publisher/subscriber lines. Leaving just:

public void CreateBAQView()
	{
		baq2063 = new BAQDataView("2063");
		oTrans.Add("CustTerritoryBAQ", baq2063);
    }

I thought this would return the whole BAQ without filtering, but I got nothing. In the designer it is 7,000+ rows unfiltered.

I played around with this tonight, I did it several ways and the grid always filled as expected. I’m assuming you bound the grid to the BAQ in the designer, or else you wouldn’t have gotten the columns.

The only other thing I see is try to change the following from:

		if(pub == null)
		{
			oTrans.PublishColumnChange(pubBinding, "MyCustomPublish");
			pub = oTrans.GetPublisher(pubBinding);
		}

to

		if(pub == null)
		{
			string pubName = Guid.NewGuid().ToString();
			oTrans.PublishColumnChange(pubBinding, pubName);
			pub = oTrans.GetPublisher(pubBinding);
		}

No luck. I am thinking it has something to do with the BAQ (maybe because of the Customer table?). I changed it to a simple BAQ of some of the OrderHed fields and the publisher/subscriber worked fine. Although, maybe that is because the OrderNum is already being published in the Order Entry form?

Got it! Simple mistake: I was using the EpiContextMenuKey instead of the actual EpiBinding for the field I wanted to publish. I also forgot to take out a filter in my BAQ when I was testing it. Thanks for helping me troubleshoot!