hmwillett
(Hannah Willett 🏳️🌈⚧)
October 31, 2017, 3:10pm
1
I’m working on a customization to pull the AP Invoice Date into the Chart Tracker Transaction Detail grid.
I have it pull the APInvoiceNum from the grid and pass it to the below function, however I’m getting a “There’s no row at position 0” error which is telling me nothing is coming back from the dataset.
I confirmed that it’s properly getting the invcNum string. How else can I debug this dataset?
private string CallAPInvoiceAdapterGetDataMethod(string invcNum)
{
try
{
if( invcNum == "" )
return "";
APInvoiceAdapter adapterAPInvoice = new APInvoiceAdapter(this.oTrans);
adapterAPInvoice.BOConnect();
System.Data.DataSet dsAPInvoice = adapterAPInvoice.GetData(invcNum);
string invcDate = "";
invcDate = dsAPInvoice.Tables["APInvHed"].Rows[0]["InvoiceDate"].ToString();
adapterAPInvoice.Dispose();
return invcDate;
}
catch (System.Exception ex){return "";}
}
Anyone have any ideas?
You can use something like this -
private void CallAPInvoiceAdapterGetCurrentDataSetMethod()
{
try
{
// Declare and Initialize EpiDataView Variables
// Declare and create an instance of the Adapter.
APInvoiceAdapter adapterAPInvoice = new APInvoiceAdapter(this.oTrans);
adapterAPInvoice.BOConnect();
// Declare and Initialize Variables
bool morePages;
string InvcDate = "";
string InvoiceNum = "123";
SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
opts.DataSetMode = DataSetMode.RowsDataSet;
opts.NamedSearch.WhereClauses.Add("APInvHed","InvoiceNum = " + InvoiceNum );
opts.PageSize = 0;
// Call Adapter method
DataSet dsAPInvoice = adapterAPInvoice.GetRows(opts, out morePages);
InvcDate = dsAPInvoice.Tables["APInvHed"].Rows[0]["InvoiceDate"].ToString();
// Cleanup Adapter Reference
adapterAPInvoice.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}
hmwillett
(Hannah Willett 🏳️🌈⚧)
November 6, 2017, 1:58pm
3
Thanks! I had to add single quotes around the invoice num in the where clause, but that got me going.
hmwillett
(Hannah Willett 🏳️🌈⚧)
November 6, 2017, 2:09pm
4
@danbedwards my next question would be… Is there any way to make this more efficient? Going on and querying something for every transaction line has (obviously) diminished performance quite a bit.
Yes, you can do something like this -
Hi Jose, I have added a custom (date) field to the PO Release tab, that purchasing would like to see in the Buyer Workbench under PO’s -> Open PO’s -> Late, Today, This Week, Future. I have done something similar for the Part Transaction...
1 Like