Created
April 15, 2020 18:12
-
-
Save hasokeric/b23861a6d5060a7eb7cff4940563506f to your computer and use it in GitHub Desktop.
Epicor UBAQ C# - Invoke UBAQ from Customization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Epicor UBAQ C# - Invoke UBAQ from Customization | |
// Invoke UBAQ from Customization, shows how to add new Rows and then when Update is called they are Mass Updated (I do have Allow Multi Row Update on my BAQ, not sure if it matters). | |
public System.Data.DataSet xyz() | |
{ | |
// Declare and create an instance of the Adapter. | |
DynamicQueryAdapter adapterDynamicQuery = new DynamicQueryAdapter(this.oTrans); | |
adapterDynamicQuery.BOConnect(); | |
// Declare and Initialize Variables | |
string BAQName = "HASO-FileWrite"; | |
bool more; | |
var dqds = adapterDynamicQuery.GetQueryExecutionParametersByID(BAQName); | |
var ds = adapterDynamicQuery.GetList(BAQName, dqds, 0, 0, out more); | |
var newRow = ds.Tables["Results"].NewRow(); | |
newRow["Calculated_FileName"] = "fffffff"; | |
newRow["Calculated_Content"] = "rrrrrra"; | |
newRow["RowMod"] = "A"; | |
newRow["SysRowID"] = Guid.NewGuid(); | |
newRow["RowIdent"] = newRow["SysRowID"].ToString(); | |
ds.Tables["Results"].Rows.Add(newRow); | |
var newRow2 = ds.Tables["Results"].NewRow(); | |
newRow2["Calculated_FileName"] = "cccccccc"; | |
newRow2["Calculated_Content"] = "eeeeee"; | |
newRow2["RowMod"] = "A"; | |
newRow2["SysRowID"] = Guid.NewGuid(); | |
newRow2["RowIdent"] = newRow2["SysRowID"].ToString(); | |
ds.Tables["Results"].Rows.Add(newRow2); | |
adapterDynamicQuery.Update(BAQName, ds); | |
// Get Results if we need to read for example a Success or Failure Column | |
// results.Tables["Results"].Rows[0]["Calculated_SomeSuccessColumn"] | |
DataSet results = adapterDynamicQuery.QueryResults; | |
// Cleanup Adapter Reference | |
adapterDynamicQuery.Dispose(); | |
return results; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment