I’m trying to use BAQ Markup in a BAQ to be used in a customization to the Mass Receipts form, in the Actions menu of Receipt Entry.
When I do, my query returns no results. If I change the BAQ to accept a parameter and pass it, I get the expected results.
Not sure what I’m doing wrong. Any ideas?
BAQ Query Text (w/ BAQ Markup):
select
[PODetail].[Company] as [PODetail_Company],
[PODetail].[PONUM] as [PODetail_PONUM],
[PODetail].[POLine] as [PODetail_POLine],
[PODetail].[PartNum] as [PODetail_PartNum],
[PODetail].[RevisionNum] as [PODetail_RevisionNum],
[Manufacturer].[Name] as [Manufacturer_Name],
[PODetail].[MfgPartNum] as [PODetail_MfgPartNum],
[PartRev].[DrawingNumber_c] as [PartRev_DrawingNumber_c],
[PartRev].[DrawingRevision_c] as [PartRev_DrawingRevision_c]
from Erp.PODetail as PODetail
left outer join Erp.Manufacturer as Manufacturer on
PODetail.Company = Manufacturer.Company
And
PODetail.MfgNum = Manufacturer.MfgNum
left outer join Erp.PartRev as PartRev on
PODetail.Company = PartRev.Company
And
PODetail.PartNum = PartRev.PartNum
And
PODetail.RevisionNum = PartRev.RevisionNum
where (PODetail.PONUM = [EpiBinding:RcvHead.PONum])
Form Customization Code:
(Code relevant to making the BAQ call)
/// Get Part Details by ReceiptEntry_PartDetails BAQ
private void GetPartDetails()
{
try
{
// Get current PONum from RcvHead
var rcvHeadRow = this.edvRcvHead.dataView.Cast<DataRowView>().FirstOrDefault();
var poNum = rcvHeadRow["PONum"].ToString();
// Set up BAQ query
string queryID = "ReceiptEntry_PartDetails";
DynamicQueryAdapter queryAdapter = new DynamicQueryAdapter(this.oTrans);
queryAdapter.BOConnect();
// Set PONum parameter value. Only used if BAQ accepts parameter. Not used in case of BAQ Markup.
var queryExecutionDataSet = queryAdapter.GetQueryExecutionParametersByID(queryID);
queryExecutionDataSet.ExecutionParameter.Clear();
queryExecutionDataSet.ExecutionParameter.AddExecutionParameterRow("PONum", poNum, "int", false, Guid.NewGuid(), "A");
// Execute Query and get results table
queryAdapter.ExecuteByID(queryID, queryExecutionDataSet);
partDetailsTable = queryAdapter.QueryResults.Tables["Results"];
}
catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}