Hi Everyone!
I am working on a custom dashboard containing a rather simple BAQ.
The goal is to update the Resource Group IDs for all open jobs. For example I want to change any instance of resource group ID = “12VA” to “4A”.
To keep things flexible, my approach is to provide the user a small form requesting the old resource group ID, and the new resource group ID. After the user enters the old resource group ID, they will click a button, populating the grid with the jobs and operations that will be updated in the next step. (This is where I am stuck at.)
Once the user reviews the list of jobs and operations to be updated, they will click a button to update the actual fields in the tables. (This is my next step.)
I built the form using a customized dashboard with an empty tracker view. To this, I added the text boxes, buttons, and the grid.
The first button pulls the list of jobs/ops to update based on what the user enters in the textbox. The BAQ has a parameter “OldResGrpID” to filter the results on the ResourceGroupID field. I am attempting to set that parameter through this code. However, this returns an error (shown below).
private void epiButtonC1_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
DynamicQueryAdapter yourbaq = new DynamicQueryAdapter(oTrans);
DataTable results;
yourbaq.BOConnect();
string baqname = "ChangeOpenJobResGrpIDs";
Ice.BO.DynamicQueryDataSet dsQuery = yourbaq.DynamicQueryData;
if (dsQuery.DynamicQuery.Rows.Count == 0)
{
Ice.BO.DynamicQueryDataSet dsQDesign = yourbaq.QueryDesignData;
DataRow targetRow;
foreach (DataTable table in dsQuery.Tables)
{
foreach (DataRow sourceRow in dsQDesign.Tables[table.ToString()].Rows)
{
targetRow = table.NewRow();
targetRow.ItemArray = sourceRow.ItemArray;
table.Rows.Add(targetRow);
}
}
}
Ice.BO.QueryExecutionDataSet dsBAQ = yourbaq.GetQueryExecutionParameters(dsQuery);
dsBAQ.ExecutionParameter[0].ParameterID = "OldResGrpID";
dsBAQ.ExecutionParameter[0].IsEmpty = false;
dsBAQ.ExecutionParameter[0].ParameterValue = epiTextBoxC1.Value.ToString();
dsBAQ.AcceptChanges();
// Run the query using the users old resource group ID as the filter
yourbaq.Execute(dsQuery, dsBAQ);
// Set results of query to the grid view
epiUltraGridC1.DataSource=yourbaq.QueryResults.Tables["Results"].DefaultView;
}
The error is:
Application Error
Exception caught in: Epicor.ServiceModel
Error Detail
Message: Can’t find query definition in passed dataset
Program: Epicor.ServiceModel.dll
Method: ShouldRethrowNonRetryableExceptionClient Stack Trace
at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet dataSets)
at Ice.Proxy.BO.DynamicQueryImpl.GetQueryExecutionParameters(DynamicQueryDataSet queryDS)
at Ice.Adapters.DynamicQueryAdapter.GetQueryExecutionParameters(DynamicQueryDataSet ds)
at Script.epiButtonC1_Click(Object sender, EventArgs args) in c:\ProgramData\Epicor\centralusdtpilot01.epicorsaas.com-443\3.2.400.0\VTAERO\CustomDLLs\App.ChangeResGrpIDs.MainController.EP.VTAERO.Customization.Customized1.CustomCode.7.cs:line 353
at System.Windows.Forms.Control.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButtonBase.OnClick(EventArgs e)
at Ice.Lib.Framework.EpiButton.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButton.OnMouseUp(MouseEventArgs e)
at Ice.Lib.Framework.EpiButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Tracing with VS indicates the error is with this line:
Ice.BO.QueryExecutionDataSet dsBAQ = yourbaq.GetQueryExecutionParameters(dsQuery);
What am I missing with dsQuery? I am almost certain it is a picky syntax issue.
I am still working out the code to process the update. I will keep this thread updated until we come up with a solution. I am open to alternative suggestions for performing the required task.
Thanks for your time!
Nate