Good morning,
I have a custom dashboard with a handful of combo boxes for things like part number, revision, and job number. My goal is to use my BAQs to populate the combo boxes. For example, I have a combo box for revision. The BAQ takes in a part number parameter, then returns all the revisions (with open jobs) for the part. That way the user can only pick a revision that applies to the part, and has an open job. To expand on this working example, here is the BAQ SQL:
select
[PartRev].[RevisionNum] as [PartRev_RevisionNum],
[PartRev].[RevShortDesc] as [PartRev_RevShortDesc]
from Erp.JobHead as JobHead
left outer join Erp.PartRev as PartRev on
JobHead.PartNum = PartRev.PartNum
where (JobHead.JobClosed = false and JobHead.PartNum = @part)
Inside the customization, I wait for the user to enter a value in the part number text box, then leave the text box before updating the revision combo box with this code:
private void MyPartNum_Leave(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if (MyPartNum.Text!="")
{
getRevs();
cmbRevs.ForceRefreshList();
}
}
private void getRevs()
{
cmbRevs = (Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("a03dd350-74a0-4382-b1cb-251c5e41ed9a");
DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
dqa.BOConnect();
QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("getPartRev");
qeds.ExecutionParameter.Clear();
qeds.ExecutionParameter.AddExecutionParameterRow("part", MyPartNum.Text, "nvarchar", false, Guid.NewGuid(), "A");
dqa.ExecuteByID("getPartRev", qeds);
if (dqa.QueryResults.Tables["Results"].Rows.Count > 0)
{
cmbRevs.DataSource = dqa.QueryResults.Tables["Results"];
cmbRevs.DisplayMember = "PartRev_RevShortDesc";
cmbRevs.ValueMember = "PartRev_RevShortDesc";
oTrans.NotifyAll();
}
else
{
cmbRevs.DataSource = "";
cmbRevs.DisplayMember = "";
cmbRevs.ValueMember = "";
oTrans.NotifyAll();
MessageBox.Show("Part Not Found!");
}
}
To reiterate, the above works great! The BAQ populates the combo box without popping up a parameter window. However, when I try the same thing with another combo box and BAQ, the parameter popup keeps appearing. Here is the BAQ for finding open jobs based on the part number and revision chosen:
select
[JobHead].[JobNum] as [JobHead_JobNum]
from Erp.JobHead as JobHead
left outer join Erp.PartRev as PartRev on
PartRev.PartNum = JobHead.PartNum
and ( PartRev.RevisionNum = @rev )
where (JobHead.JobClosed = false and JobHead.PartNum = @part)
Inside the customization, I update the jobs combo box after I leave the revision field like this:
private void epiRevs_Leave(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if (epiRevs.Value.ToString()!="")
{
getJobs();
cmbJobs.ForceRefreshList();
//MessageBox.Show("Getting Jobs for part: " + MyPartNum.Text + " rev: " + epiRevs.Value.ToString());
}
}
private void getJobs()
{
cmbJobs = (Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("ab3e6a13-bcc2-45bb-8f27-e93f11951026");
DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
dqa.BOConnect();
QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("Jobs");
qeds.ExecutionParameter.Clear();
qeds.ExecutionParameter.AddExecutionParameterRow("part", MyPartNum.Text, "nvarchar", false, Guid.NewGuid(), "A");
qeds.ExecutionParameter.AddExecutionParameterRow("rev", epiRevs.Value.ToString(), "nvarchar", false, Guid.NewGuid(), "A");
dqa.ExecuteByID("Jobs", qeds);
if (dqa.QueryResults.Tables["Results"].Rows.Count > 0)
{
cmbJobs.DataSource = dqa.QueryResults.Tables["Results"];
cmbJobs.DisplayMember = "JobHead_JobNum";
cmbJobs.ValueMember = "JobHead_JobNum";
oTrans.NotifyAll();
}
else
{
MessageBox.Show("No Open Jobs!");
}
}
My confusion is with the two BAQs. In the first I require a part number parameter. This works well without showing a parameter popup. The parameter value just gets passed through the c# code. However, in the second BAQ, I require two parameters, one for part and another for revision. This BAQ insists on showing the parameter popup. I want the parameters to pass silently from the C# code to the BAQ.
What is causing this inconsistency? It can’t just be the fact that there are two parameters in the second BAQ, right?
I appreciate any ideas!
Thanks!
Nate