BAQDataView broken after upgrade to 2021.2

Hi folks, we recently upgraded from 10.2.300 to 2021.2. This has been a pretty smooth transition. But, I have a problem with a customization we did to the Purchase Advisor form. I used a BAQ Data View to replace the supplier price list grid. When I use the form now, the grid is empty. I have used “Test Code”, and it comes back as “Compiled Successfully”, so I don’t think I have any syntax errors. I have also verified that the grid is set to use “PurchAdvisorPriceListBAQ” as it’s collection. Is the problem that I am re-using the grdSupplierPartList grid? I’m not a full time programmer, and figured out how to use BAQDataView from posts on this forum. Are their changes in Kinetic I need to use to make this work?

// **************************************************
// Custom code for PurchaseAdvisorEntryForm
// Created: 5/6/2022 3:36:10 PM
// **************************************************

extern alias Erp_Contracts_BO_PartOnHandWhse;
extern alias Erp_Contracts_BO_Part;

using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Ice.Lib.Broadcast;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **
	BAQDataView baqAdvPriceList;


	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls
		CreatePriceListBAQView();

	}
	public void CreatePriceListBAQView()
	{
		baqAdvPriceList = new BAQDataView("PurchAdvisorPriceList");
		oTrans.Add("PurchAdvisorPriceListBAQ",baqAdvPriceList);
		string pubBinding = "Part.PartNum";
		IPublisher pub = oTrans.GetPublisher(pubBinding);
		if(pub==null)
		{
			oTrans.PublishColumnChange(pubBinding, "MyCustomPublish");
			pub = oTrans.GetPublisher(pubBinding);
		}
		
		if(pub !=null)
			baqAdvPriceList.SubscribeToPublisher(pub.PublishName, "VendPart_PartNum");
	}
	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}
}

I see you didn’t assign it to the existing grid in code, but used the UI.
It is possible some behind the scenes code is changing that

I would assign the binding to the grid after the form has loaded via code & call a refresh, or hide the original grid
and replace it with a new one.

A simple refresh on grdSupplierPartList might do it if the binding is not overridden.


//add to form load

EpiUltraGrid myRefTo_grdSupplierPartList = (EpiUltraGrid)csm.GetNativeControlReference("guid_of_this_control");

myRefTo_grdSupplierPartList.Refresh(); //I think

Thanks, I added an new ultraGrid, and used the GUI to select the collection. It’s connecting, because I see the correct column headings (they match what is in the BAQ). But it’s just not pulling the data into the grid.

Thanks for the advice. I tried adding the refresh but no luck. Not sure how to assign the grid in code.

So I rewatched the video here: BAQ Dataview Example Video - #35 by Banderson and updated my customization.
(Direct link to YouTube video by Carson: Epicor BAQ DataView - YouTube )
I have it working now. I think I had some confusion about where to put the BAQ name. In the code below, my BAQ is named “PurchAdvisorPriceList”

// **************************************************
// Custom code for PurchaseAdvisorEntryForm
// Created: 5/6/2022 3:36:10 PM
// **************************************************

extern alias Erp_Contracts_BO_PartOnHandWhse;
extern alias Erp_Contracts_BO_Part;

using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Ice.Lib.Broadcast;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **
	BAQDataView AdvPriceListDV;

	public void InitializeCustomCode()
	{
		CreatePriceListBAQDV();
		
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls
		

	}
	
	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}
public void CreatePriceListBAQDV()
	{
		AdvPriceListDV = new BAQDataView("PurchAdvisorPriceList");
		oTrans.Add("PurchAdvisorPriceList",AdvPriceListDV);
		string pub1Binding = "Partlist.PartNum";
		IPublisher pub1 = oTrans.GetPublisher(pub1Binding);
		if(pub1==null)
		{
			string pubName = Guid.NewGuid().ToString();
			oTrans.PublishColumnChange(pub1Binding, pubName);
			pub1 = oTrans.GetPublisher(pub1Binding);
		}
		
		if(pub1 !=null)
			AdvPriceListDV.SubscribeToPublisher(pub1.PublishName, "VendPart_PartNum");
	}
}
1 Like