Saving data from a dataview

I think that's already happening (or I'm still misunderstanding the
difference). There is another method in the script doing this when the
button is clicked:


Private Sub btnCalcWithTax_Click(ByVal Sender As Object, ByVal Args As
System.EventArgs) Handles btnCalcWithTax.Click
oTrans.Update()
oTrans.Refresh()

Dim quoteHed As EpiDataView =
CType(oTrans.EpiDataViews("QuoteHed"),EpiDataView)

'//Get the Tax region from the customer
Dim taxRegionCode As String =
GetTaxRegion(quoteHed.dataview(quoteHed.Row)("CustomerCustID"))

'//Calculate the total of the sales taxes in the region
Dim percentSumOfTaxes As Single = GetSumAllTaxes(taxRegionCode) / 100
quoteHed.dataView(quoteHed.Row)("TotalPotential") = (percentSumOfTaxes
+ 1) * quoteHed.dataView(quoteHed.Row)("TotalPotential")

'//Update the Screen to display the values
quoteHed.Notify(New EpiNotifyArgs(QuoteForm, quoteHed.Row, 0))
End Sub


The values on-screen do update after this method is called.

That was my starting point. After that executes, if I save the entry
at that point, the values get reverted.

--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> --- In vantage@yahoogroups.com, "steve.thoms" <steve.thoms@> wrote:
> >
> > Forgive me as I'm still learning my way around the Epi framework and
> > how all the objects and methods fit together...I've done a full day
> > worth of searching here (and elsewhere) and experimentation with a
> > little progress but no solution.
> >
> > We have a customization on the Quote Entry screen that correctly
> > updates data in an EpiDataView and displays that on the form (adding
> > tax to Potential and Expected when a button is clicked). When we
> save
> > that entry, however, the data reverts back to the pre-tax
> > value/calculation.
> >
> > I'm somewhat confident I need to use an adapter (QuoteAdapter), get
> > the data associated with the Quote Number I'm working with, manually
> > update the appropriate column values, and update the adapter.
> >
> > What I've tried so far results in a data lock when I save. I get a
> > message indicating "someone else has changed the record and I should
> > refresh and reenter the data".
> >
> > This is the gist of what I've tried so far:
> >
> > Private Sub SaveTaxCalculation()
> > Dim quoteAdapter As QuoteAdapter = New QuoteAdapter(QuoteForm)
> > Dim adapterConnected As Boolean
> >
> > adapterConnected = quoteAdapter.BOConnect()
> >
> > If (adapterConnected) Then
> > quoteAdapter.GetByID(quoteHed.dataView(quoteHed.Row)("QuoteNum"))
> >
> > quoteAdapter.QuoteData.QuoteHed.Rows(0)("TotalPotential") =
> > quoteHed.dataView(quoteHed.Row)("TotalPotential")
> >
> > quoteAdapter.Update()
> > End If
> >
> > quoteAdapter.Dispose()
> > End Sub
> >
> >
> > The values in the adapter data do change (confirmed with MessageBox
> > output) after the assignment. If I leave the Dispose() call in, I
> get
> > the record lock I mentioned. If I take it out, the data reverts back
> > to the pre-tax values.
> >
> > Can anyone tell me if this is even the right direction to be heading
> > or better yet, offer some advice on how to get this working?
> >
> > Thanks everyone...
> >
> > -Steve
> >
> The QuoteEntry Form already has a quote adapter defined. You need to
> update the data in that adapters dataview and notify the dataview
> that you updated some data. When you instantiated a second quote
> adapter it is like two people trying to open the same Excel
> workbook.... only one of them can update...
>
> bw
>
Forgive me as I'm still learning my way around the Epi framework and
how all the objects and methods fit together...I've done a full day
worth of searching here (and elsewhere) and experimentation with a
little progress but no solution.

We have a customization on the Quote Entry screen that correctly
updates data in an EpiDataView and displays that on the form (adding
tax to Potential and Expected when a button is clicked). When we save
that entry, however, the data reverts back to the pre-tax
value/calculation.

I'm somewhat confident I need to use an adapter (QuoteAdapter), get
the data associated with the Quote Number I'm working with, manually
update the appropriate column values, and update the adapter.

What I've tried so far results in a data lock when I save. I get a
message indicating "someone else has changed the record and I should
refresh and reenter the data".

This is the gist of what I've tried so far:

Private Sub SaveTaxCalculation()
Dim quoteAdapter As QuoteAdapter = New QuoteAdapter(QuoteForm)
Dim adapterConnected As Boolean

adapterConnected = quoteAdapter.BOConnect()

If (adapterConnected) Then
quoteAdapter.GetByID(quoteHed.dataView(quoteHed.Row)("QuoteNum"))

quoteAdapter.QuoteData.QuoteHed.Rows(0)("TotalPotential") =
quoteHed.dataView(quoteHed.Row)("TotalPotential")

quoteAdapter.Update()
End If

quoteAdapter.Dispose()
End Sub


The values in the adapter data do change (confirmed with MessageBox
output) after the assignment. If I leave the Dispose() call in, I get
the record lock I mentioned. If I take it out, the data reverts back
to the pre-tax values.

Can anyone tell me if this is even the right direction to be heading
or better yet, offer some advice on how to get this working?

Thanks everyone...

-Steve
--- In vantage@yahoogroups.com, "steve.thoms" <steve.thoms@...> wrote:
>
> Forgive me as I'm still learning my way around the Epi framework and
> how all the objects and methods fit together...I've done a full day
> worth of searching here (and elsewhere) and experimentation with a
> little progress but no solution.
>
> We have a customization on the Quote Entry screen that correctly
> updates data in an EpiDataView and displays that on the form (adding
> tax to Potential and Expected when a button is clicked). When we
save
> that entry, however, the data reverts back to the pre-tax
> value/calculation.
>
> I'm somewhat confident I need to use an adapter (QuoteAdapter), get
> the data associated with the Quote Number I'm working with, manually
> update the appropriate column values, and update the adapter.
>
> What I've tried so far results in a data lock when I save. I get a
> message indicating "someone else has changed the record and I should
> refresh and reenter the data".
>
> This is the gist of what I've tried so far:
>
> Private Sub SaveTaxCalculation()
> Dim quoteAdapter As QuoteAdapter = New QuoteAdapter(QuoteForm)
> Dim adapterConnected As Boolean
>
> adapterConnected = quoteAdapter.BOConnect()
>
> If (adapterConnected) Then
> quoteAdapter.GetByID(quoteHed.dataView(quoteHed.Row)("QuoteNum"))
>
> quoteAdapter.QuoteData.QuoteHed.Rows(0)("TotalPotential") =
> quoteHed.dataView(quoteHed.Row)("TotalPotential")
>
> quoteAdapter.Update()
> End If
>
> quoteAdapter.Dispose()
> End Sub
>
>
> The values in the adapter data do change (confirmed with MessageBox
> output) after the assignment. If I leave the Dispose() call in, I
get
> the record lock I mentioned. If I take it out, the data reverts back
> to the pre-tax values.
>
> Can anyone tell me if this is even the right direction to be heading
> or better yet, offer some advice on how to get this working?
>
> Thanks everyone...
>
> -Steve
>
The QuoteEntry Form already has a quote adapter defined. You need to
update the data in that adapters dataview and notify the dataview
that you updated some data. When you instantiated a second quote
adapter it is like two people trying to open the same Excel
workbook.... only one of them can update...

bw