Skip to content

Instantly share code, notes, and snippets.

@jlewin
Last active October 14, 2016 18:31
Show Gist options
  • Save jlewin/1724875 to your computer and use it in GitHub Desktop.
Save jlewin/1724875 to your computer and use it in GitHub Desktop.
// Execute BAQ with parameter
using (var session = new Epicor.Mfg.Core.Session("user", "secret", "AppServerDC://server:port"))
{
// DynamnicQuery for BAQ
var dynamicQuery = new Epicor.Mfg.BO.DynamicQuery(session.ConnectionPool);
// Build Parameters DS
QueryExecutionDataSet executionDS = new QueryExecutionDataSet();
// Actual parameter row
var paramRow = executionDS.ExecutionParameter.NewRow();
paramRow["ParameterName"] = "StartDate";
paramRow["ParameterValue"] = "6/15/2011";
paramRow["ValueType"] = "date";
paramRow["IsEmpty"] = "False";
paramRow["RowIdent"] = "";
paramRow["RowMod"] = "";
paramRow["DBRowIdent"] = new byte[0];
executionDS.ExecutionParameter.Rows.Add(paramRow);
// Out variable which indicates if more results are available (likely for use with topNRecords)
bool hasMoreRecords;
// Executed named BAQ with parameter
var results = dynamicQuery.ExecuteByIDParametrized("01-NamedBAQ", executionDS, "", 0, out hasMoreRecords);
// Store results
results.WriteXml(@"c:\temp\BAQWithParamResults.xml");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment