# BAQDataView broken after upgrade to 2021.2

**URL:** <https://www.epiusers.help/t/baqdataview-broken-after-upgrade-to-2021-2/96655>\
**Category:** Kinetic ERP\
**Created:** [November 21, 2022, 5:41pm UTC](https://www.epiusers.help/t/baqdataview-broken-after-upgrade-to-2021-2/96655 "2022-11-21T17:41:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![IronMB](https://www.epiusers.help/letter_avatar_proxy/v4/letter/i/b5e925/32.png) [@IronMB](https://www.epiusers.help/u/IronMB)\
**Post date:** [November 21, 2022, 5:41pm UTC](https://www.epiusers.help/t/baqdataview-broken-after-upgrade-to-2021-2/96655/1 "2022-11-21T17:41:37Z")

</div>

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?

```auto
// **************************************************
// 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
	}
}

```

---

<div class="post-metadata">

**Author:** ![klincecum](https://www.epiusers.help/user_avatar/www.epiusers.help/klincecum/32/100137_2.png) [@klincecum](https://www.epiusers.help/u/klincecum)\
**Post date:** [November 21, 2022, 5:53pm UTC](https://www.epiusers.help/t/baqdataview-broken-after-upgrade-to-2021-2/96655/2 "2022-11-21T17:53:18Z")

</div>

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.

```auto

//add to form load

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

myRefTo_grdSupplierPartList.Refresh(); //I think

```

---

<div class="post-metadata">

**Author:** ![IronMB](https://www.epiusers.help/letter_avatar_proxy/v4/letter/i/b5e925/32.png) [@IronMB](https://www.epiusers.help/u/IronMB)\
**Post date:** [November 21, 2022, 5:58pm UTC](https://www.epiusers.help/t/baqdataview-broken-after-upgrade-to-2021-2/96655/3 "2022-11-21T17:58:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![IronMB](https://www.epiusers.help/letter_avatar_proxy/v4/letter/i/b5e925/32.png) [@IronMB](https://www.epiusers.help/u/IronMB)\
**Post date:** [November 22, 2022, 1:11pm UTC](https://www.epiusers.help/t/baqdataview-broken-after-upgrade-to-2021-2/96655/4 "2022-11-22T13:11:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![IronMB](https://www.epiusers.help/letter_avatar_proxy/v4/letter/i/b5e925/32.png) [@IronMB](https://www.epiusers.help/u/IronMB)\
**Post date:** [November 22, 2022, 4:33pm UTC](https://www.epiusers.help/t/baqdataview-broken-after-upgrade-to-2021-2/96655/5 "2022-11-22T16:33:07Z")

</div>

So I rewatched the video here: [BAQ Dataview Example Video - #35 by Banderson](https://www.epiusers.help/t/baq-dataview-example-video/70295/35) and updated my customization.  
(Direct link to YouTube video by Carson: [Epicor BAQ DataView - YouTube](https://www.youtube.com/watch?v=7xBrqwpg4_k) )  
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”

```auto
// **************************************************
// 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");
	}
}

```
