I think it depends on what data you are getting back and what you want to do with it (display on BAQ data form ? Or modify the main table you are dealing with). I dont think you can run a BAQ from a BPM just using widgets but there are a number of setter widgets to update fields or tables based on a query (not used them myself but there designer does look a lot like the BAQ designer).
You can run a BAQ but its not nice. For example, you could display BAQ results on the BPM data forms themselves but you’d need to add a customisation and add some code. You may be able to adapt the following code:
‘’'cs
// Execute a BAQ by Calling the Client Adapter
private void CallBAQUsingAdapter()
{
try
{
// Declare and create an instance of the Adapter.
DynamicQueryAdapter adapterDynamicQuery = new DynamicQueryAdapter(this.oTrans);
adapterDynamicQuery.BOConnect();
// Declare and Initialize Variables
string BAQName = "DIEN-HASO";
Ice.BO.QueryExecutionDataSet ds = new Ice.BO.QueryExecutionDataSet();
// Add Parameter Rows
// Definition: AddExecutionParameterRow(string ParameterID, string ParameterValue, string ValueType, bool IsEmpty, Guid SysRowID, string RowMod)
// Possible ValueTypes: nvarchar, int, decimal, date, datetime, bit, uniqueidentifier, bigint
// IsEmpty indicates if your passed value Is Empty because if it is, you can define in your params to use a default value if empty.
// Typically you use string.IsNullOrEmpty(yourValueVariable) but if you are hard coding a value then you can simply set it to false
ds.ExecutionParameter.AddExecutionParameterRow("QuoteNumber", "10003", "int", false, Guid.Empty, "A");
ds.ExecutionParameter.AddExecutionParameterRow("FirstName", "Bill", "nvarchar", false, Guid.Empty, "A");
// Call Adapter method
adapterDynamicQuery.ExecuteByID(BAQName, ds);
// Lets Loop through our results
if (adapterDynamicQuery.QueryResults.Tables["Results"].Rows.Count > 0)
{
foreach (DataRow item in adapterDynamicQuery.QueryResults.Tables["Results"].Rows)
{
// In E9 you used TableName.Column in E10 it is TableName_Column
string val = item["QuoteHed_QuoteNum"].ToString();
}
}
// Cleanup Adapter Reference
adapterDynamicQuery.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}’’’
You can also run a BAQ from c# code using the Execute Custom Code widget, again you’d need to adapt the following code to suit:
‘’'cs
try
{
// Declare and Initialize Variables
string BAQName = “DIEN-HASO”;
Ice.BO.QueryExecutionDataSet ds = new Ice.BO.QueryExecutionDataSet();
// Add Parameter Rows
// Definition: AddExecutionParameterRow(string ParameterID, string ParameterValue, string ValueType, bool IsEmpty, Guid SysRowID, string RowMod)
// Possible ValueTypes: nvarchar, int, decimal, date, datetime, bit, uniqueidentifier, bigint
// IsEmpty indicates if your passed value Is Empty because if it is, you can define in your params to use a default value if empty.
// Typically you use string.IsNullOrEmpty(yourValueVariable) but if you are hard coding a value then you can simply set it to false
ds.ExecutionParameter.AddExecutionParameterRow("QuoteNumber", "10003", "int", false, Guid.Empty, "A");
ds.ExecutionParameter.AddExecutionParameterRow("FirstName", "Bill", "nvarchar", false, Guid.Empty, "A");
// Use Business Object Directly
Ice.Proxy.BO.DynamicQueryImpl dynamicQuery = WCFServiceSupport.CreateImpl<Ice.Proxy.BO.DynamicQueryImpl>((Ice.Core.Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.DynamicQuerySvcContract>.UriPath);
System.Data.DataSet results = dynamicQuery.ExecuteByID(BAQName, ds);
// Lets Loop through our results
if (results.Tables["Results"].Rows.Count > 0)
{
foreach (DataRow item in results.Tables["Results"].Rows)
{
// In E9 you used TableName.Column in E10 it is TableName_Column
string val = item["QuoteHed_QuoteNum"].ToString();
}
}
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}’’’
Hope this helps.
Regards,
Jon