MES - Work Queue - Async Column Update

Hello,

My company requires a customized column in the Work Queue’s Active Work table. I have code working that, in the EpiViewNotification, loops through the rows and updates the custom column with the appropriate value. Issue is, the code causes a slowdown in the Work Queue form. I’ve tried to use Async/Await but I get errors popup like “bindingsource cannot be its own datasource”.

How I was trying to accomplish it was by building a method to pull the data for the custom column:

public void ProcessCustomCol(EpiDataView view)
{
foreach (DataRow dr in view.dataView.Table.Rows)
{
// Run method to pull data for custom column and update custom column
}
}

Then I created an Async method to run this function:

public async void ProcessCustomColAsync(EpiDataView view)
{
await Task.Run(() => ProcessCustomCol(view));
}

The behavior of the form works better, especially when clicking the Select checkboxes in the active work column, but I get those binding errors. I read online that the grids are not thread safe.

I appreciate any thoughts you may have, thank you!

EpiViewNotification fires a lot and having your custom code execute every time is probably a lot more frequent than you require. Here are a few ideas:

  • Use a local boolean to determine if the custom code should execute. Use a timer to to set the boolean to true every x seconds. In your handler for EpiViewNotification, only execute if the boolean is true and set it back to false after executing.

  • Use some diagnostics to identify the different cases when EpiViewNotification fires and only execute your custom code in certain cases.

  • Consider using a different event to execute your custom code.

3 Likes

Thank you for the thoughts!

1 Like