Customer BAQ based grid does not referesh when group by is selected on a column

I have a custom grid based on a BAQ. The Grid is part of the TaskList entry screen. Currently the Grid contents will change when the workforce is selected. However, three problems are recently encountered during testing:

  1. When the Grid is in enabled with a group-by column, and the workforce is changed, the grid list will not change to the new workforce selected. This only happens when the group-by is enabled.

  2. If the refresh button is pressed, while the group-by column is enabled, the grid list will not update to the new workforce selected.

TaskList1.pdf (36.1 KB)

I used the following code during the form load:

// MGA - 12-JUN-2018
		// Added for the replacement of the Shipments> tab grid Dataview ShipAll. A new DataView will be created based on the
		// Create the BAQ DataView for the replacment of the ShipAl. 
		// use custom BAQ - MGATaskList
		CreateTaskListBAQView();
		//Obtain the Guid reference value for the Shipments> All grid. 
		myGridTaskList = (EpiUltraGrid)csm.GetNativeControlReference("51974bfc-d373-47e5-b2ec-fd60e9321929");
// MGA - 12-JUN-2018 - Task > List> tab
	public void CreateTaskListBAQView()
	{

		// Initialize the BAQDataView by giving it the BAQ name that will be used.
		baqViewTaskList = new BAQDataView("MGATaskList-V6");
        //baqViewTaskList = new BAQDataView("MGATaskList-V6MAIN"); 

		//baqViewTaskList = new BAQDataView("MGA-TEST5");

		// This will add the BAQDataView to the form, so we can bind it to the grid. The DataView will be called "CustTrackershipment".  
		oTrans.Add("MGATaskList",baqViewTaskList);

        //string pubBinding  = "Task.DueDate";  // this is the actual table name from the Task view. 
        string pubBinding2 = "Task.SalesRepCode";  // this is the actual table name from the Task view. 
		//IPublisher pub  = oTrans.GetPublisher(pubBinding); // if the publisher exist, then a publisher name will be returned. 
        IPublisher pub2 = oTrans.GetPublisher(pubBinding2);

		// The following code is only needed if the filter field "Customer.CustID" have NOT been published. In this case I am using a standard column. 
        // Most likely the CustID is published. If this was an uncommon column like a UD field, I would need to check and publish the field. The code in 
		// place will check for this condition. The purpose of the publisher, is everytime the Customer.CustID is changed, the new value becomes available
		// and the BAQ DataView is filtered accordingly. The BAQ DataView will have all the customers in it.  	
				
		//if(pub==null) // if no publisher
		//{
			//MessageBox.Show("if not null".ToString());
		//	oTrans.PublishColumnChange(pubBinding, "MyCustomPublish1");  // publish it
		//	pub = oTrans.GetPublisher(pubBinding); // get a hold of that publisher 
		//}
		if (pub2==null)
		{
			//MessageBox.Show("if not null".ToString());
			oTrans.PublishColumnChange(pubBinding2, "MyCustomPublish2");  // publish it
			pub2 = oTrans.GetPublisher(pubBinding2); // get a hold of that publisher 
        }
		// MessageBox.Show("before if pub != null".ToString());
		//if(pub !=null) // if we have that publisher available then we want to subscribe (filter) the BAQDataView to that publisher
		// Filter on Task_SalesRepCode. 
		//baqViewTaskList.SubscribeToPublisher(pub.PublishName, "Task_DueDate"); // this is the actual column name from the BAQ
		if (pub2 != null)
        baqViewTaskList.SubscribeToPublisher(pub2.PublishName, "Task_SalesRepCode"); // this is the actual column name from the BAQ

// MGA - 18-JUL-2018, make the Task DV the child of the custom MGAtaskList DV
		edvTask = (EpiDataView) oTrans.EpiDataViews["Task"];
		this.edvTask.SetParentView(baqViewTaskList,"Task_Key1", "Key1", "=");
		//this.edvTask.SetParentView(baqViewTaskList,"Task_SalesRepCode", "SalesRepCode", "=");
	}


I also have the following code in the following events for the case of the refresh and save:

	private void TaskListForm_BeforeToolClick(object sender, Ice.Lib.Framework.BeforeToolClickEventArgs args)
	{
	
		
		// MessageBox.Show(args.Tool.Key);
		// Check if the RefreshTool has been clicked. If so, we don't want to clear the Shipmenents grid 
		// So we set a global flag
		//Boolean RefreshClicked ;
		switch (args.Tool.Key)
			{
	
				case "SaveTool":
					// MessageBox.Show("Case Save is Yes - clearing the grid");
					//RefreshClicked = true;
					// Clear the BAQ dataview grid. 
		       	 foreach (Infragistics.Win.UltraWinGrid.UltraGridRow dr in myGridTaskList.Rows.All)
		              {
		                  dr.Delete(false);
                          //MessageBox.Show("Case Save is Yes - clearing the grid");
                          
		              } 
                    oTrans.NotifyAll(); // Notify all publishers to update their grids.
					oTrans.Refresh();
					break;
	
				case "RefreshTool":
					//MessageBox.Show("Case RefreshTool is Yes - clearing the grid");
					//RefreshClicked = true;
					// Clear the BAQ dataview grid. 
		       	 foreach (Infragistics.Win.UltraWinGrid.UltraGridRow dr in myGridTaskList.Rows.All)
		              {
		                  dr.Delete(false);
		              } 
					oTrans.NotifyAll(); // Notify All publishers to update their grids.
					oTrans.Refresh();
					break;
	
				case "MRUTool":
					//MessageBox.Show("Case MRUTool is Yes - clearing the grid");
					//RefreshClicked = true;
					// Clear the BAQ dataview grid. 
		       	 foreach (Infragistics.Win.UltraWinGrid.UltraGridRow dr in myGridTaskList.Rows.All)
		              {
		                  dr.Delete(false);
		              } 
					break;
	
				default: 
					//RefreshClicked = false;
					break;
			}
	
	
	}
  1. The third issue I am having is that, when the user clicks refresh they are not getting a new BAQ list from the database, the refresh is only based on the original list when the form was loaded. I would like to be able to force refresh of the BAQ from the database and not the BAQ list currently in memory.

This avoids having to clear the form, and reentering the same workforce to get a fresh list from the database.

Problems 1 & 2 may be able to be solved by programatically removing the group by and then putting it back after the BAQ reloads.
Ungroup it with:
GridName.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.Horizontal;

Put the Group By back with:
GridName.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;

1 Like

I will try your solution. But what if the user did not user a group-by, will these commands still work?

You can add a check to determine the state of the grid (group or not) to see if they need to run.

Thanks Jason, I will try your suggestion on Sunday. However, I will always have an issue regarding #3 because the grid is not updating from the database but from the BAQ at form load time.

You could always call your BAQ query on your refresh too. And then use it to refresh your dataset. Iā€™m just using mine here as the datasource for the grid but you could use the results for whatever.

	DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
	dqa.BOConnect();
	QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("D7DASPBB");
	qeds.ExecutionParameter.Clear();
	qeds.ExecutionParameter.AddExecutionParameterRow("PartRefCategory", refParam, "navchar", false, Guid.NewGuid(), "A");
	qeds.ExecutionParameter.AddExecutionParameterRow("PartNum", partParam, "navchar", false, Guid.NewGuid(), "A");
	dqa.ExecuteByID("D7DASPBB", qeds);
	invUG.DataSource = dqa.QueryResults.Tables["Results"];

Jason thank so much for all your suggestions. As of Sunday, I have attempted the following:

  1. When the user clicks refresh, I notify the source DV which is (this.edvSalesview) that contains the WorkForceID. This apparently corrected problem #3. So now, when the referesh is clicked, (including from another session) , the screen does update with the most currently list, which means the BAQ has to run.
				case "RefreshTool":
					//MessageBox.Show("Case RefreshTool is Yes - clearing the grid");
					//RefreshClicked = true;
					// Clear the BAQ dataview grid. 
                     this.edvSalesView.Notify(new EpiNotifyArgs(oTrans,baqViewTaskList.Row,baqViewTaskList.Column));
		       	  foreach (Infragistics.Win.UltraWinGrid.UltraGridRow dr in myGridTaskList.Rows.All)
		              {
		                  dr.Delete(false);
		              } 
  					
					//oTrans.Refresh();
					break;'

I will report back on problem 1 and 2.

Your solution for 1 & 2 worked. Thank you. Now, I just have to check if a group band is used and insert the code in the appropriate event section.