Loop Through Rows in DataView

Thanks for the help. I got it to work. Might not be the most
conventional but it is working. I noticed if I selected the first
line it then run the code it would not throw the error, so I just
set rows(0).selected = True for the grid & there we go. The user
never notices it because it does not change the screen at all.


--- In vantage@yahoogroups.com, "laidig.systems"
<laidig.systems@...> wrote:
>
> that error message seems like a buisiness objects error method,
not a
> vb.net compile error message. I use the loop and set values
inside
> the loop (for each line) just using:
> edvOrderDtl.dataView(i)("ShortChar10") = ModelName
>
> --- In vantage@yahoogroups.com, "Michael McWilliams"
> <mmcwilliams22@> wrote:
> >
> > It works great to read values but when i try to set it using
the
> > same method. I get the following an error
> > Exception caught in: Epicor.Mfg.BO.SalesOrder
> >
> > Error Detail
> > ============
> > Message: Order Header has not changed.
> > Type: Error
> > Program: bo/SalesOrder.p
> > Method: CheckOrderHedChanges
> > Table: OrderHed
> > Row:
> > Field:
> >
> >
> >
> > Stack Trace
> > ===========
> > at Epicor.Mfg.Proxy.SalesOrderImpl.CheckOrderHedChanges
> > (SalesOrderDataSet ds, String& cOrderChangedMsgText)
> > at
Epicor.Mfg.UI.Adapters.SalesOrderAdapter.CheckOrderHedChanges()
> > --- In vantage@yahoogroups.com, "Michael McWilliams"
> > <mmcwilliams22@> wrote:
> > >
> > > So if I were to get values using this method I would use this
for
> > > example?
> > > Length As Decimal = edvOrderDtl.dataView(i)("Number01")
> > >
> > >
> > > --- In vantage@yahoogroups.com, "laidig.systems"
> > > <laidig.systems@> wrote:
> > > >
> > > > try this:
> > > > Dim edvOrderDtl As EpiDataView =
> > > > CType(oTrans.EpiDataViews("OrderDtl"), EpiDataView)
> > > > For i As Integer = 0 To edvOrderDtl.dataView.Count-
> > > 1
> > > > msgbox(edvOrderDtl.dataView(i)
("OrderLine").ToString)
> > > > next
> > > >
> > > > --- In vantage@yahoogroups.com, "Michael McWilliams"
> > > > <mmcwilliams22@> wrote:
> > > > >
> > > > > I am trying to loop through all the rows when I am in
Order
> > > Entry. To
> > > > > keep the test simple I am Just trying to display the
OrderLine
> > > for the
> > > > > Row. With the code I am using below it gives the message
box
> > > the same
> > > > > number of times as how many lines there are. But it
always
> > > displays
> > > > > only the first line in the message box. Here is what I
have
> > > > > Dim OrderDtl As EpiDataView = Ctype(oTrans.EpiDataViews
> > > > > ("OrderDtl"),EpiDataView)
> > > > > For Each dr As DataRow In OrderDtl.DataView.Table.Rows
> > > > > Dim OrderLine As Integer = OrderDtl.DataView
(OrderDtl.Row)
> > > > > ("OrderLine")
> > > > > msgbox(OrderLine.ToString)
> > > > > Next
> > > > >
> > > >
> > >
> >
>
I am trying to loop through all the rows when I am in Order Entry. To
keep the test simple I am Just trying to display the OrderLine for the
Row. With the code I am using below it gives the message box the same
number of times as how many lines there are. But it always displays
only the first line in the message box. Here is what I have
Dim OrderDtl As EpiDataView = Ctype(oTrans.EpiDataViews
("OrderDtl"),EpiDataView)
For Each dr As DataRow In OrderDtl.DataView.Table.Rows
Dim OrderLine As Integer = OrderDtl.DataView(OrderDtl.Row)
("OrderLine")
msgbox(OrderLine.ToString)
Next
try this:
Dim edvOrderDtl As EpiDataView =
CType(oTrans.EpiDataViews("OrderDtl"), EpiDataView)
For i As Integer = 0 To edvOrderDtl.dataView.Count-1
msgbox(edvOrderDtl.dataView(i)("OrderLine").ToString)
next

--- In vantage@yahoogroups.com, "Michael McWilliams"
<mmcwilliams22@...> wrote:
>
> I am trying to loop through all the rows when I am in Order Entry. To
> keep the test simple I am Just trying to display the OrderLine for the
> Row. With the code I am using below it gives the message box the same
> number of times as how many lines there are. But it always displays
> only the first line in the message box. Here is what I have
> Dim OrderDtl As EpiDataView = Ctype(oTrans.EpiDataViews
> ("OrderDtl"),EpiDataView)
> For Each dr As DataRow In OrderDtl.DataView.Table.Rows
> Dim OrderLine As Integer = OrderDtl.DataView(OrderDtl.Row)
> ("OrderLine")
> msgbox(OrderLine.ToString)
> Next
>
So if I were to get values using this method I would use this for
example?
Length As Decimal = edvOrderDtl.dataView(i)("Number01")


--- In vantage@yahoogroups.com, "laidig.systems"
<laidig.systems@...> wrote:
>
> try this:
> Dim edvOrderDtl As EpiDataView =
> CType(oTrans.EpiDataViews("OrderDtl"), EpiDataView)
> For i As Integer = 0 To edvOrderDtl.dataView.Count-
1
> msgbox(edvOrderDtl.dataView(i)("OrderLine").ToString)
> next
>
> --- In vantage@yahoogroups.com, "Michael McWilliams"
> <mmcwilliams22@> wrote:
> >
> > I am trying to loop through all the rows when I am in Order
Entry. To
> > keep the test simple I am Just trying to display the OrderLine
for the
> > Row. With the code I am using below it gives the message box
the same
> > number of times as how many lines there are. But it always
displays
> > only the first line in the message box. Here is what I have
> > Dim OrderDtl As EpiDataView = Ctype(oTrans.EpiDataViews
> > ("OrderDtl"),EpiDataView)
> > For Each dr As DataRow In OrderDtl.DataView.Table.Rows
> > Dim OrderLine As Integer = OrderDtl.DataView(OrderDtl.Row)
> > ("OrderLine")
> > msgbox(OrderLine.ToString)
> > Next
> >
>
It works great to read values but when i try to set it using the
same method. I get the following an error
Exception caught in: Epicor.Mfg.BO.SalesOrder

Error Detail
============
Message: Order Header has not changed.
Type: Error
Program: bo/SalesOrder.p
Method: CheckOrderHedChanges
Table: OrderHed
Row:
Field:



Stack Trace
===========
at Epicor.Mfg.Proxy.SalesOrderImpl.CheckOrderHedChanges
(SalesOrderDataSet ds, String& cOrderChangedMsgText)
at Epicor.Mfg.UI.Adapters.SalesOrderAdapter.CheckOrderHedChanges()
--- In vantage@yahoogroups.com, "Michael McWilliams"
<mmcwilliams22@...> wrote:
>
> So if I were to get values using this method I would use this for
> example?
> Length As Decimal = edvOrderDtl.dataView(i)("Number01")
>
>
> --- In vantage@yahoogroups.com, "laidig.systems"
> <laidig.systems@> wrote:
> >
> > try this:
> > Dim edvOrderDtl As EpiDataView =
> > CType(oTrans.EpiDataViews("OrderDtl"), EpiDataView)
> > For i As Integer = 0 To edvOrderDtl.dataView.Count-
> 1
> > msgbox(edvOrderDtl.dataView(i)("OrderLine").ToString)
> > next
> >
> > --- In vantage@yahoogroups.com, "Michael McWilliams"
> > <mmcwilliams22@> wrote:
> > >
> > > I am trying to loop through all the rows when I am in Order
> Entry. To
> > > keep the test simple I am Just trying to display the OrderLine
> for the
> > > Row. With the code I am using below it gives the message box
> the same
> > > number of times as how many lines there are. But it always
> displays
> > > only the first line in the message box. Here is what I have
> > > Dim OrderDtl As EpiDataView = Ctype(oTrans.EpiDataViews
> > > ("OrderDtl"),EpiDataView)
> > > For Each dr As DataRow In OrderDtl.DataView.Table.Rows
> > > Dim OrderLine As Integer = OrderDtl.DataView(OrderDtl.Row)
> > > ("OrderLine")
> > > msgbox(OrderLine.ToString)
> > > Next
> > >
> >
>
that error message seems like a buisiness objects error method, not a
vb.net compile error message. I use the loop and set values inside
the loop (for each line) just using:
edvOrderDtl.dataView(i)("ShortChar10") = ModelName

--- In vantage@yahoogroups.com, "Michael McWilliams"
<mmcwilliams22@...> wrote:
>
> It works great to read values but when i try to set it using the
> same method. I get the following an error
> Exception caught in: Epicor.Mfg.BO.SalesOrder
>
> Error Detail
> ============
> Message: Order Header has not changed.
> Type: Error
> Program: bo/SalesOrder.p
> Method: CheckOrderHedChanges
> Table: OrderHed
> Row:
> Field:
>
>
>
> Stack Trace
> ===========
> at Epicor.Mfg.Proxy.SalesOrderImpl.CheckOrderHedChanges
> (SalesOrderDataSet ds, String& cOrderChangedMsgText)
> at Epicor.Mfg.UI.Adapters.SalesOrderAdapter.CheckOrderHedChanges()
> --- In vantage@yahoogroups.com, "Michael McWilliams"
> <mmcwilliams22@> wrote:
> >
> > So if I were to get values using this method I would use this for
> > example?
> > Length As Decimal = edvOrderDtl.dataView(i)("Number01")
> >
> >
> > --- In vantage@yahoogroups.com, "laidig.systems"
> > <laidig.systems@> wrote:
> > >
> > > try this:
> > > Dim edvOrderDtl As EpiDataView =
> > > CType(oTrans.EpiDataViews("OrderDtl"), EpiDataView)
> > > For i As Integer = 0 To edvOrderDtl.dataView.Count-
> > 1
> > > msgbox(edvOrderDtl.dataView(i)("OrderLine").ToString)
> > > next
> > >
> > > --- In vantage@yahoogroups.com, "Michael McWilliams"
> > > <mmcwilliams22@> wrote:
> > > >
> > > > I am trying to loop through all the rows when I am in Order
> > Entry. To
> > > > keep the test simple I am Just trying to display the OrderLine
> > for the
> > > > Row. With the code I am using below it gives the message box
> > the same
> > > > number of times as how many lines there are. But it always
> > displays
> > > > only the first line in the message box. Here is what I have
> > > > Dim OrderDtl As EpiDataView = Ctype(oTrans.EpiDataViews
> > > > ("OrderDtl"),EpiDataView)
> > > > For Each dr As DataRow In OrderDtl.DataView.Table.Rows
> > > > Dim OrderLine As Integer = OrderDtl.DataView(OrderDtl.Row)
> > > > ("OrderLine")
> > > > msgbox(OrderLine.ToString)
> > > > Next
> > > >
> > >
> >
>
Hi Michael,



This is the code we use to turn "engineered" on and off in quote entry.




'// Add Custom Module Level Variables Here **



'-Declare a member variable for the quote adapter need to use
EngineerLines()

Dim oQuoteAdapter as QuoteAdapter



Sub InitializeCustomCode()



oTrans_Adapter = csm.TransAdaptersHT("oTrans_adapter")

edvQuoteHed = CType(oTrans.EpiDataViews("QuoteHed"),
EpiDataView)

tmpQuoteNum = 0

'-- Create an instance of the quote adapter

'-- then connect it to the session pool.

oQuoteAdapter = new QuoteAdapter(QuoteForm)

Try

oQuoteAdapter.BOConnect()

Catch ex as Exception


ExceptionBox.show(ex,EpiString.GetString("boError"))

End Try



End Sub



Sub DestroyCustomCode()

oQuoteAdapter.dispose()

oQuoteAdapter = nothing

End Sub



'// ENGINEER LINES
------------------------------------------------------------------------

Private Sub btnPSEngineer_Click(ByVal Sender As Object, ByVal Args
As System.EventArgs) Handles btnPSEngineer.Click

'// ** Place Event Handling Code Here **

Call EngineerLines()

End Sub



Private Sub EngineerLines()

'// Engineer all lines



'-- Declare the dataview

Dim edvQuoteHed as EpiDataview =
CType(oTrans.EpiDataViews("QuoteHed"),epiDataView)

' messagebox.show("Dataview declared")

'-- Load the quote

Dim Quote as Int32 =
edvQuoteHed.dataView(edvQuotehed.Row)("QuoteNum")

' messagebox.show("Quote loaded")





oQuoteAdapter.QuoteData.Clear()

if not oQuoteAdapter.GetByID(Quote) then

messagebox.show("Could not load quote")

return

end if



Dim edvQuoteDtl As EpiDataView =
CType(oTrans.EpiDataViews("QuoteDtl"), EpiDataView)

Dim ReadyState As Boolean =
edvQuoteDtl.dataView(edvQuoteDtl.Row)("ReadyToQuote")



'-- Loop through records and update the values

for i as integer = 0 to
oQuoteAdapter.QuoteData.QuoteDtl.Rows.Count - 1

ReadyState =
edvQuoteDtl.dataView(edvQuoteDtl.Row)("ReadyToQuote")

' messagebox.show(readystate)

if ReadyState = true then

oQuoteAdapter.QuoteData.QuoteDtl(i)("ReadyToQuote") =
false

else

oQuoteAdapter.QuoteData.QuoteDtl(i)("ReadyToQuote") =
true

end if

next

oQuoteAdapter.Update()



Cleanup:

'-- After it is done updating the records, refresh and notify forms
about changes



oTrans.NotifyAll()

oTrans.Refresh()

'-- let the user know that it is finished

messagebox.show("Finished")



end sub



'// END ENGINEER LINES
--------------------------------------------------------------------





HTH

Linda





[Non-text portions of this message have been removed]