Key not found: 'StatusCode' - Customization for TaskList

I am not sure what this error message mean. I customized the TaskList screen with a BAQ DV. See code below: But everytime the TaskList is loaded the following error is displayed, but the BAQ DV does run and work.

Application Error

Exception caught in: Infragistics4.Shared.v12.2

Error Detail

Message: Key not found: ‘StatusCode’
Parameter name: key
Program: Infragistics4.Shared.v12.2.dll
Method: GetItem

Client Stack Trace

at Infragistics.Shared.KeyedSubObjectsCollectionBase.GetItem(String key)
at Infragistics.Win.UltraWinGrid.ColumnsCollection.get_Item(String key)
at Erp.UI.App.TaskListEntry.TaskListForm.SetupCombos()
at Erp.UI.App.TaskListEntry.TaskListForm.SetDisplay()
at Ice.Lib.Framework.EpiBaseForm.setupUIElements()

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("if not null".ToString());
		oTrans.PublishColumnChange(pubBinding, "MyCustomPublish1");  // publish it
		pub = oTrans.GetPublisher(pubBinding); // 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 the Customer_CustNum column in the custom BAQDataView. 
	baqViewTaskList.SubscribeToPublisher(pub.PublishName, "Task_SalesRepCode"); // this is the actual column name from the BAQ

The warning message occurs when the following line executes:
baqViewTaskList.SubscribeToPublisher(pub.PublishName, “Task_SalesRepCode”);

The problem appears to happen in the setup of combos. More specifically, it appears it’s looking to the ultragrid columns to find data that doesn’t exist. I’d check my order of operations first.

This is odd because I used the Base TaskList to make sure no other customization exist.

I check and the BAQDV does has a column call Task_StatusCode… The field is listed under the

It looks like if I change the TaskList grid binding back from the BAQtask DV to Task default DV the error goes away. So is there a way to bind the BAQtask DV to the grid after the screen initialize? or is there a simpler solution ?

Where are you creating your BAQView - Initialization or FormLoad?

1 Like

In the form Initialization

if I attempt to create the BAQview from the Load event, I get the following error:

Application Error

Exception caught in: Ice.Lib.EpiClientLib

Error Detail

Message: Control ‘eugTaskList’ of type EpiUltraGridWithEmbeddedControl has an invalid binding to view MGATaskListView.
Program: Ice.Lib.EpiClientLib.dll
Method: EventSetup

Client Stack Trace

at Ice.Lib.Framework.EpiUltraGrid.EventSetup()
at Ice.Lib.Framework.EpiUltraGridWithEmbeddedControl.EventSetup()
at Ice.Lib.Framework.EpiUltraGrid.set_EpiTransaction(IEpiTransaction value)
at Ice.Lib.Framework.EpiUIUtils.BindNConfigureControls()

This error makes sense, because the MGATaskListView has been binded to the TaskList grid.

In the SetupCombos() func:

this.mainDockPanel1.taskListPanel1.eugTaskList.DisplayLayout.Bands[0].Columns["StatusCode"].ValueList = this.mainDockPanel1.taskListPanel1.cmbTaskStatus;

Are you messing with the eugTaskList grid? Even if you only changed the banding, it could wreck this code,

Unrelated, but this is interesting…it goes on forerver:
image

I am only changing, the TaskList grid binding property from Task DV to MGATaskListView BAQ DV. The MGATaskListView is created from the form initialization function.

Thats the problem. You no longer have the “StatusCode” column…you then have “Task_StatusCode”. Perhaps modify the underlying table column name in code if possible?

Thank you. I created an custom grid a left the original. The error no longer occurs.

Glad to help you get the solution.

Can you explain this a little more, please?.

In the initial problem, the user was using a control that required a specific field (StatusCode) - instead he used a BAQ to feed a dataview that he bound to the control. While technically it contained the field, due to baq naming, it was Task_StatusCode (as opposed to StatusCode).

My thought was that he could change the column name to make it do what he wanted. It’s a little more complicated than that because everytime the BAQ runs, it will dump the original name. So you would need to put some events on the table to catch and change it everytime.

In general, you can do:

//if needed, you get datatable from view
var dt = edv.dataView.Table;
dt.Columns["EXCELCOLUMNS"].ColumnName = "COLUMN_NAME";                        
 dt.AcceptChanges();