How to row sync the dataview of the TaskList with replaced dynamic BAQdataveiw

I have managed to replace the TaskList > List> tab grid with a BAQ which subscribes to the original Task grid dataview. But now, when I click on the row of the grid, the TaskList> Details> tab fields will not update because the row focus is not on the original Task dataveiw but on the replacement dataveiw. Is there a way to row sync the two dataviews? I am open to an alternate method(s) of replacing the TaskList grid dataview. Please advise.
Thx.

pick a key value from your grid - when you change your row, search the original EDV for that key - if found, set the row of the original EDV

Do you mean I have to loop the data view and count the rows?

EpiDataView edvTaskTo = ((EpiDataView)(oTrans.EpiDataViews[“Task”]));

string sKey1= “”;
Integer row = 0;

foreach(DataRow dr in edvTaskTo.dataView.Table.Rows)
{
if (dr[“Key1”].ToString() == edvTask.dataView[edvTaskTo.Row][“Key1”];
{
Insert set row focuse here?
}
row = row+1;
}

The source DV has over 1500 rows. The loop method will be very inefficient.

You didnt ask for efficiency :smile:

Perhaps set the parent view of the original edv to yours?

public void SetParentView(EpiDataView parent, string parentColumn, string childColumn)
{
this.SetParentView(parent, parentColumn, childColumn, “=”);
}

LOL…
I am not sure, I am subscripting to the original view call Task. Will this work.

public void CreateTaskListBAQView()
{

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

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

    string pubBinding = "Task.SalesRepCode";  
	IPublisher pub = oTrans.GetPublisher(pubBinding); // if the publisher exist, then a publisher name will be returned. 

	// 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("CustID was not published".ToString());
		oTrans.PublishColumnChange(pubBinding, "MyCustomPublish1");  // publish it
		pub = oTrans.GetPublisher(pubBinding); // get a hold of that publisher 
	}
    
	if(pub !=null) // if we have that publisher available then we want to subscribe (filter) the BAQDataView to that publisher
	// Filter on the Customer_CustNum column in the custom BAQDataView. 
	baqViewTaskList.SubscribeToPublisher(pub.PublishName, "Task_SalesRepCode"); // this is the actual column name from the BAQ
	
}

I have not tried your suggestion. But would like to ask if this is even possible? To force a source DV subscribed for by a custom DV (BAQ) and then making the source DV the child and custom DV the parent?

Ok, I tried you method but now each time I click on the BAQDV row, I am getting the following error:

Application Error

Exception caught in: Ice.Lib.EpiClientLib

Error Detail

Message: Object reference not set to an instance of an object.
Program: Ice.Lib.EpiClientLib.dll
Method: BuildCriteriaForColumn

Client Stack Trace

at Ice.Lib.Framework.EpiDataView.BuildCriteriaForColumn(Int32 rowIndex, String sourceColumnName, String targetColumnName)
at Ice.Lib.Framework.EpiDataView.AppendCriteriaForColumns(DataViewCriteriaBuilder criteriaBuilder, String[] sourceColumnNames, String[] targetColumnNames)
at Ice.Lib.Framework.EpiDataView.BuildChildFilterWhenHasCurrentRow(EpiDataView childView)
at Ice.Lib.Framework.EpiDataView.SetChildFilterAndNotifyChildViewWhenHasCurrentRow(EpiDataView childView, EpiNotifyArgs args, Boolean forceIt)
at Ice.Lib.Framework.EpiDataView.SetChildFiltersAndNotifyChildViews(EpiNotifyArgs args, Boolean forceIt)
at Ice.Lib.Framework.EpiDataView.Notify(EpiNotifyArgs args)
at Ice.Lib.Framework.EpiDataView.NavigateToRow(Int32 newRow)
at Ice.Lib.Framework.EpiUltraGrid.beforeSelected(Object sender, BeforeSelectChangeEventArgs ea)

You sure about those column names? I would expect a baq would more along the line of UD100_Key1, etc

Fantastic, its working now when I click on the row of the dvBAQ is the Details are show. This means the set ParentChild relationship is working. Wow.

1 Like

// MGA - 18-JUL-2018, make the Task DV the child of the custom MGAtaskList DV. BAQ column name corrected for the parent DV.
edvTask = (EpiDataView) oTrans.EpiDataViews[“Task”];
his.edvTask.SetParentView(baqViewTaskList,“Task_Key1”, “Key1”, “=”);

The only problem now is when a refresh occurs in the dvTask which the default dv of the Tasklist screen, the BAQdv which is subscribing to the dvTask does not get refreshed. It contains the rows from the first load.

To be clear, if the Details of the dvTask row is updated the task is moved to another Sales Rep, meaning the task is completed and row is removed, the row from dvBAQTask is not removed and would need to perform a full database refresh.

The solution you provided did work by making the TaskList dv a child. This solves the row sync issue. Thank you.

Please give the solution to the person who actually solved it for you…

1 Like

@asmar the solution should go to @Chris_Conn who solved the problem for you… Not me…

:wink:

Any chance you could provide some details on how you solved the row sync problem? I am trying to do exactly this. I’ve replaced the dataview with a BAQDataView and have the details tab working. When I make changes on details, the list BAQDataView does not update.

I used the following code:

``

// 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-V2");

	// 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”, “=”);
}