I've figured out what the problem was. Changing "UPDATE" method to "SubmitSelected" Method seems to do the trick. It looks like UPDATE was eventually being overwritten by SubmitSelected right after the write making it blank again.
--- In vantage@yahoogroups.com, "duckorz" <don.n.doan@...> wrote:
>
> I've wrote some code to pull some information from the EmpExpense database when making an expense entry. It's pulling a few different fields to make a unique receipt number for our employee's. One of the fields I need to pull from is EmpExpenseNum and is created at the time of UPDATE. I've tried to use this customization in the BeforeAdapterMethod but the EmpExpenseNum field hasn't been written yet. When I use AfterAdapterMethod I get the data I need but it isn't writing to the database field. I have an epibinding linked to the custom field I'm trying to write to and I see it pop up for a fraction of a second but when I open the SQL DB or go back to the expense I don't see it in there. Is there a way to get this receipt number I'm making to write during AfterAdapterMethod? Here is the code that pulls and writes that information.
>
>
>
> rivate void oTrans_empExpenseAdapter_AfterAdapterMethod(object sender, AfterAdapterMethodArgs args)
> {
> switch (args.MethodName)
> {
> case "Update":
> EpiDataView edvEmpExpense = ((EpiDataView)(oTrans.EpiDataViews["EmpExpense"]));
> string method = edvEmpExpense.dataView[edvEmpExpense.Row]["PMUID"].ToString();
> string method2 = "EX";
> if (method == "8")
> {
> method2 = "CC";
> }
> string empID = edvEmpExpense.dataView[edvEmpExpense.Row]["EmpID"].ToString();
> DateTime expenseDate = DateTime.Parse (edvEmpExpense.dataView[edvEmpExpense.Row]["ExpenseDate"].ToString());
> string expDate = expenseDate.ToString("MMddyy");
> string expNum = edvEmpExpense.dataView[edvEmpExpense.Row]["EmpExpenseNum"].ToString();
> string receiptNum = (method2 + "-" + expDate + "-" + empID + "-" + expNum);
> edvEmpExpense.dataView[edvEmpExpense.Row]["Character01"] = receiptNum;
> MessageBox.Show ("Write this number on the top of the receipt: " + receiptNum);
> break;
> }
>
> }
>