Thank you for sharing your example code. I have a similar project. I tried your code it works great. However, I can’t get the parameter to work. I am passing a value to the correct parameterID for a calculated field for my BAQ. The dynamic query always returns all rows instead of the filtered rows.
Does the parameter filter correctly when you just use the BAQ?
Yes, the following is what I am using in the data directive BPM?
using (var dq =
Ice.Assemblies.ServiceRenderer.GetService<DynamicQuerySvcContract>(Db))
{
// Specifiy BAQ input parameter name "LastActivity" is calculated field column name.
var BAQname = dq.GetQueryExecutionParametersByID("MGATaskListCriticalAlert");
// MGATaskListCriticalAlert
var paramLastActivity = BAQname.ExecutionParameter.Where(r=>r.ParameterID=="LastActivity").FirstOrDefault();
//var paramLastActivity = BAQname.ExecutionParameter.Where (r=>r.ParameterID=="LastActivity");
// Declare value for the input parameter LastActivity
BAQname.ExecutionParameter.Clear();
paramLastActivity.ParameterValue = Convert.ToString("-62");
// Declare data set for the returning rows and execute the query
var ds = dq.ExecuteByID("MGATaskListCriticalAlert",BAQname);
// C# BLOCK must be synchronous. to work with the send email block asynchronous.
callContextBpmData.Character01 = Convert.ToString(ds.Tables["Results"].Rows[10]["Task_Key1"]);
//
}
The code example shared in the following post worked,
Execute Dynamic Query within BPM Data Directive - #6 by asmar