I am trying to configure a DynamicQueryAdapter in my customization to call a GetNew method so that I can preset a bunch of the fields. I have the adapter instantiated but I am struggling because the GetNew wants to return a DataSet. The examples I’ve followed refer to a QueryExecutionDataSet but the customization errors when I use that because it says it returns a Data.DataSet. I know I need to edit the new row in the table, but I can’t figure out what the correct properties are to access this row. Help, please.
Here’s my standard boilerplate for DQA’s. If you have multiple parameters, you add more AddExecutionParameterRow calls. I can’t say I’ve ever user a GetNew method from that module, or knew there was one.
private void GetBaqStuffForJob(string job, string baqName, EpiDataView edv)
{
using (var adapter = new DynamicQueryAdapter(oTrans))
{
adapter.BOConnect();
var qeds = new QueryExecutionDataSet();
qeds.ExecutionParameter.AddExecutionParameterRow("JobNum", job, "nvarchar", false, Guid.Empty, "");
adapter.ExecuteByID(baqName, qeds);
edv.dataView = adapter.QueryResults.Tables["Results"].DefaultView;
}
}
Here’s something similar I’ve done, but again not GetNew method
DataRow editRow = this._ud36Adapter.UD36Data.UD36.Rows[(rowCount - 1)];
DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
dqa.BOConnect();
QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("YourBAQ");
qeds.ExecutionParameter.Clear();
qeds.ExecutionParameter.AddExecutionParameterRow("YourBaqParam", partnum, "nvarchar", false, Guid.NewGuid(), "A");
dqa.ExecuteByID("YourBAQ", qeds);
editRow.BeginEdit();
if (dqa.QueryResults.Tables["Results"].Rows.Count > 0)
{
Whateva = dqa.QueryResults.Tables[0].Rows[0][0].ToString();
editRow["YourField"] = Whateva.ToString();
}
dqa.Dispose();
editRow.EndEdit();
GetNew in DynamicQuery is for UBAQ GetNew call.
Use BAQDesignerSvc if you want tableset for query.
Maybe I’m not going about this the right way. So I have a customized updateable dashboard assembly. My expectation is that I am highlighted on an existing row and then I want to copy the existing information of the row I’m highlighted on. Then I want the effect of clicking the New button but for it to pre-populate most of the information for the new line from the info I’ve copied and ultimately maybe leave 1 or 2 fields that need to be entered by the user.
Am I even going about this the right way?
Okay…I get it. I haven’t done that kind of thing, specifically. I suspect it requires grabbing the highlighted DataRow, and copying it into a table in the DataSet returned by GetNew(). But, again, that’s just spitballing based on other things I’ve done.
What is the end game to display data or to store it?
What is the record of the get new? UD36 or uBAQ? Have you tried this in the BPM editor?
End game is to create a new record partially filled in so a person can fill in the rest. They are tasks at the end is the day.
Dan
Might want to check out the BPM on get new record vs customization code.
I feel like I’m close. I am currently using an EpiViewNotification to populate some callContextBpm fields with the current row’s info. Then I am receiving that in the GetNew method of the UBAQ BPM. It seems to be “working” but when I hit Save, it just spins and spins. No errors. It just sits there for awhile and never seems to save.
Here is what I have going on:
This is my customization that I fire on the EpiViewNotification for the EDV on the UDashboard when a row is initialized. It seems to pass the info into the BPM effectively when I click the New button:
private void edvV_DMR_90DaySalesPlans_1View_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
// ** Argument Properties and Uses **
// view.dataView[args.Row]["FieldName"]
// args.Row, args.Column, args.Sender, args.NotifyType
// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
{
if ((args.Row > -1))
{
//shpComplete.Enabled = (Boolean)view.dataView[args.Row]["Task_Complete"];
edvCallContextBpmData.dataView[edvCallContextBpmData.Row]["Number01"] = view.dataView[args.Row]["Task_TaskCustNum"];
edvCallContextBpmData.dataView[edvCallContextBpmData.Row]["ShortChar01"] = view.dataView[args.Row]["Task_RelatedToFile"];
edvCallContextBpmData.dataView[edvCallContextBpmData.Row]["ShortChar02"] = view.dataView[args.Row]["Task_Key1"];
edvCallContextBpmData.dataView[edvCallContextBpmData.Row]["ShortChar03"] = view.dataView[args.Row]["Task_Key2"];
edvCallContextBpmData.dataView[edvCallContextBpmData.Row]["ShortChar04"] = view.dataView[args.Row]["Task_Key3"];
edvCallContextBpmData.dataView[edvCallContextBpmData.Row]["ShortChar05"] = view.dataView[args.Row]["Task_TaskID"];
edvCallContextBpmData.dataView[edvCallContextBpmData.Row]["ShortChar06"] = view.dataView[args.Row]["Task_TaskDescription"];
edvCallContextBpmData.dataView[edvCallContextBpmData.Row]["ShortChar07"] = view.dataView[args.Row]["Task_TypeCode"];
edvCallContextBpmData.dataView[edvCallContextBpmData.Row]["ShortChar08"] = view.dataView[args.Row]["Task_SalesRepCode"];
}
}
}
This is a Post-Processing BPM on GetNew in the UBAQ:
foreach (var eachRow in (from t in ttResults
where t.RowMod == "A"
select t))
{
eachRow["Task_StartDate"] = DateTime.Today;
eachRow["Task_DueDate"] = DateTime.Today.AddDays(90);
eachRow["Task_RelatedToFile"] = callContextBpmData.ShortChar01;
eachRow["Task_Key1"] = callContextBpmData.ShortChar02;
eachRow["Task_Key2"] = callContextBpmData.ShortChar03;
eachRow["Task_Key3"] = callContextBpmData.ShortChar04;
eachRow["Task_TaskID"] = callContextBpmData.ShortChar05;
eachRow["Task_TaskDescription"] = callContextBpmData.ShortChar06;
eachRow["Task_TypeCode"] = callContextBpmData.ShortChar07;
eachRow["Task_SalesRepCode"] = callContextBpmData.ShortChar08;
eachRow["Task_TaskComment"] = "Test";
}
Stupid Update Time:
So - we had done some testing on our Test environment and were asked to disable all BPMs. Evidently, that turned off the “BASE” Update and GetNew methods on our UBAQ. That’s been fighting me the entire way. SHAKES FIST VIOLENTLY TOWARD THE SKY I enabled them both. Works like a charm. Life is good.