BAQ Dataview Example Video

Here’s an example video of how to do a BAQ dataview.

BAQ Dataviews are a great way to view related data onto a screen in Epicor. If you can link the data on the screen to the data you want to display in a BAQ you can display it. They are faster and more flexible than FKVs or embedded dashboards.

and the code.

	public void CreateOrderLineOnHandBAQDV()

		orderLineOnHandBAQDV = new BAQDataView("OrderLineOnHand");
		string pub1Binding = "OrderDtl.OrderNum"; 
		IPublisher pub1 = oTrans.GetPublisher(pub1Binding);
			string pubName = Guid.NewGuid().ToString();
			oTrans.PublishColumnChange(pub1Binding, pubName);
			pub1 = oTrans.GetPublisher(pub1Binding);
		if(pub1 !=null) 
			orderLineOnHandBAQDV.SubscribeToPublisher(pub1.PublishName, "OrderDtl_OrderNum");

		string pub2Binding = "OrderDtl.OrderLine"; 
		IPublisher pub2 = oTrans.GetPublisher(pub2Binding);
			string pubName = Guid.NewGuid().ToString();
			oTrans.PublishColumnChange(pub2Binding, pubName);
			pub2 = oTrans.GetPublisher(pub2Binding);
		if(pub2 !=null) 
			orderLineOnHandBAQDV.SubscribeToPublisher(pub2.PublishName, "OrderDtl_OrderLine");


Thanks for sharing. When would be a use case for this vs something like a dynamic query implementation l?


All kidding aside whenever possible use BAQ DataView they are fast and easy and work just like any regular DataView in your form.
So you get all the EpiMagic and the events that come with it.

BAQDataViews ROCK!


Even better is a UBAQ as a DataView custom dataset, custom methoding, and best child views ever!


So, to mimic the “Retrieve” button on trackers, I would just remove the binding and have the button trigger some code that would link them?

I hope Josh doesn’t mind me sharing his screenshot, but what Josh is refering to is he actually uses UBAQ BPMs to manage the grid, no client side code (or atleast minimal). It becomes it’s own isolated business logic grid.

You know the UDXX Wizard Generated Code… its much cleaner as a BAQDataView, and can easily be re-used in other screens.

Good god where did you dig that up HA HA HA!

The only problem with BAQ Dataviews is the refresh button doesn’t pull the BAQ data again.
To manually refresh them you can use reflection.

using System.Reflection;

   MethodInfo mi = orderLineOnHandBAQDV .GetType().GetMethod("invokeExecute", BindingFlags.Instance | BindingFlags.NonPublic);

   mi.Invoke(orderLineOnHandBAQDV , new object[]{ true });

Pretty sure this code came from @josecgomez

Correct but hey reflection is still valid code :smiley:


This is a very timely post. Thanks for sharing!

Is there an easy button for enabling updates through a BAQDV? The BAQ is updatable but the grid is forcing it to be read only.

No easy button requires reflection

And I noticed the grid refresh was not being triggered when toggling between orders with and without lines. (version E10.1.6xx).

Ref screen shot

While I was playing around with the example in the video - thanks to Carson for that BTW

Good catch @bordway.
The publisher subscribe doesn’t like not having a row. I think embedded dashboards have a similar issue.
This cleans it up. I added an EpiViewNotification to look for a change of the order number and applying a second filter to the dataview. This also clears the view when clear is pressed.

	int currentOrder = 0;
	private void edvOrderHed_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
		// ** Argument Properties and Uses **
		// view.dataView[args.Row]["FieldName"]
		// args.Row, args.Column, args.Sender, args.NotifyType
		// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
		if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
			if ((args.Row > -1))
				if (currentOrder != (int)view.dataView[args.Row]["OrderNum"])
					currentOrder = (int)view.dataView[args.Row]["OrderNum"];
				currentOrder = 0;

			orderLineOnHandBAQDV.dataView.RowFilter = String.Format("OrderDtl_OrderNum = '{0}'", currentOrder);