Custom code, extracting table data to a variable

thanks kindly for that - I'll have a play :)

--- In vantage@yahoogroups.com, Waffqle Driggers <waffqle@...> wrote:
>
> I only know c#, so I can't help you with VB syntax. But there are basically
> two ways to do it.
>
> You can use a FKV as you mentioned. You can also just call the adapter
> directly and query for the information you need. I prefer the second method
> as it allows you to update data. If you open the Object Explorer when you're
> in Developer Mode it will give you code examples for how to do this.
>
> If you update the dataView, make sure to call 'Notify' on it. Otherwise it
> won't update the UI among other weirdness.
>
> Also, you're in luck! I found some VB code I wrote a few years back before
> we switched to c# that should help you.
>
> This runs on the Service Call Center form so ShipToView already exists and
> is populated. This code pulls the serial number and customer number from the
> existing dataview and uses it to query the serial number table and populate
> a gridview with all the units belonging to that customer.
>
> The line you are interested in is the probably:
> dsSerial = SearchFunctions.listLookup(otrans, "SerialNoAdapter",
> recSelected, False, whereClause, True, "SerialNo")
> This queries the serial number table and gives you a dataset containing the
> results.
>
> '// Add Custom Module Level Variables Here **
> Dim recSelected as Boolean
> Dim whereClause as String
> Dim dsSerial As New DataSet
> Dim shipToView As New EpiDataView
> Dim edvDetailView As New EpiDataView
> Dim CustNum As New Int32
> Dim ShipToNum As String
>
> '//Get Customer Num and ShipTo Num
> shipToView = CType(oTrans.EpiDataViews("shipToView"), EpiDataView)
> CustNum = shipToView.dataView(shipToView.Row)("CustNum")
> ShipToNum = shipToView.dataView(shipToView.Row)("ShipToNum")
>
> '//Create Data Set of Customer Serials and Load Grid
> whereClause= "CustNum = '" & CustNum & "' AND ShipToNum = '" & ShipToNum &
> "'"
> dsSerial = SearchFunctions.listLookup(otrans, "SerialNoAdapter",
> recSelected, False, whereClause, True, "SerialNo")
> If(recSelected) Then
> ugdEpiCustom1.DataSource = dsSerial
> ugdEpiCustom1.DataMember = ""
> End If
>
>
> On Wed, Mar 31, 2010 at 2:56 PM, Kerry_Muntz <kerry_muntz@...> wrote:
>
> >
> >
> > Hi - I'm needing some help with how to write a couple of lines of custom
> > code to extract data to a variable.
> >
> > In the example below, I have a Button Click Event (in Part) activated set
> > of code that pulls data from Vantage EpiDataView, and writes it to a text
> > file. I'm happy with how it works, except I now want to add the field
> > CurrentRate from the CurrRate table, for the CurrencyCode = AUD.
> >
> > I don't think I can use EpiDataView for this one can I? Do I need a foreign
> > key view? Can someone please help me out with the code with this? I expect
> > it's just a couple of lines I need to turn it into a variable. I have the
> > Epicor Tools User Guide, but can't see a relevant section.
> >
> > Here's some of the working code that I'm already happy with:
> >
> > Private Sub btnAustralia1_Click(ByVal Sender As Object, ByVal Args As
> > System.EventArgs) Handles btnAustralia1.Click
> > Dim edvPart As EpiDataView = CType(oTrans.EpiDataViews("Part"),EpiDataView)
> > Dim PartNum As String = edvPart.dataView(edvPart.Row)("PartNum")
> > Dim PartDescription As String =
> > edvPart.dataView(edvPart.Row)("PartDescription")
> > Dim SalesUM As String = edvPart.dataView(edvPart.Row)("SalesUM")
> > Dim UnitPrice As String = edvPart.dataView(edvPart.Row)("UnitPrice")
> > system.threading.thread.sleep(600)
> > Dim writeFile As System.IO.TextWriter = New _
> > StreamWriter("c:\vantage_custom_swap003.txt")
> > writeFile.WriteLine(PartNum)
> > writeFile.WriteLine(PartDescription)
> > writeFile.WriteLine(SalesUM)
> > writeFile.WriteLine(UnitPrice)
> > writeFile.WriteLine("EOF") '// EOF for End of File
> > writeFile.Flush()
> > writeFile.Close()
> > writeFile = Nothing
> > End Sub
> >
> >
> > thanks kindly
> > Kerry.
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>
Hi - I'm needing some help with how to write a couple of lines of custom code to extract data to a variable.

In the example below, I have a Button Click Event (in Part) activated set of code that pulls data from Vantage EpiDataView, and writes it to a text file. I'm happy with how it works, except I now want to add the field CurrentRate from the CurrRate table, for the CurrencyCode = AUD.

I don't think I can use EpiDataView for this one can I? Do I need a foreign key view? Can someone please help me out with the code with this? I expect it's just a couple of lines I need to turn it into a variable. I have the Epicor Tools User Guide, but can't see a relevant section.

Here's some of the working code that I'm already happy with:

Private Sub btnAustralia1_Click(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles btnAustralia1.Click
Dim edvPart As EpiDataView = CType(oTrans.EpiDataViews("Part"),EpiDataView)
Dim PartNum As String = edvPart.dataView(edvPart.Row)("PartNum")
Dim PartDescription As String = edvPart.dataView(edvPart.Row)("PartDescription")
Dim SalesUM As String = edvPart.dataView(edvPart.Row)("SalesUM")
Dim UnitPrice As String = edvPart.dataView(edvPart.Row)("UnitPrice")
system.threading.thread.sleep(600)
Dim writeFile As System.IO.TextWriter = New _
StreamWriter("c:\vantage_custom_swap003.txt")
writeFile.WriteLine(PartNum)
writeFile.WriteLine(PartDescription)
writeFile.WriteLine(SalesUM)
writeFile.WriteLine(UnitPrice)
writeFile.WriteLine("EOF") '// EOF for End of File
writeFile.Flush()
writeFile.Close()
writeFile = Nothing
End Sub


thanks kindly
Kerry.
I only know c#, so I can't help you with VB syntax. But there are basically
two ways to do it.

You can use a FKV as you mentioned. You can also just call the adapter
directly and query for the information you need. I prefer the second method
as it allows you to update data. If you open the Object Explorer when you're
in Developer Mode it will give you code examples for how to do this.

If you update the dataView, make sure to call 'Notify' on it. Otherwise it
won't update the UI among other weirdness.

Also, you're in luck! I found some VB code I wrote a few years back before
we switched to c# that should help you.

This runs on the Service Call Center form so ShipToView already exists and
is populated. This code pulls the serial number and customer number from the
existing dataview and uses it to query the serial number table and populate
a gridview with all the units belonging to that customer.

The line you are interested in is the probably:
dsSerial = SearchFunctions.listLookup(otrans, "SerialNoAdapter",
recSelected, False, whereClause, True, "SerialNo")
This queries the serial number table and gives you a dataset containing the
results.

'// Add Custom Module Level Variables Here **
Dim recSelected as Boolean
Dim whereClause as String
Dim dsSerial As New DataSet
Dim shipToView As New EpiDataView
Dim edvDetailView As New EpiDataView
Dim CustNum As New Int32
Dim ShipToNum As String

'//Get Customer Num and ShipTo Num
shipToView = CType(oTrans.EpiDataViews("shipToView"), EpiDataView)
CustNum = shipToView.dataView(shipToView.Row)("CustNum")
ShipToNum = shipToView.dataView(shipToView.Row)("ShipToNum")

'//Create Data Set of Customer Serials and Load Grid
whereClause= "CustNum = '" & CustNum & "' AND ShipToNum = '" & ShipToNum &
"'"
dsSerial = SearchFunctions.listLookup(otrans, "SerialNoAdapter",
recSelected, False, whereClause, True, "SerialNo")
If(recSelected) Then
ugdEpiCustom1.DataSource = dsSerial
ugdEpiCustom1.DataMember = ""
End If


On Wed, Mar 31, 2010 at 2:56 PM, Kerry_Muntz <kerry_muntz@...> wrote:

>
>
> Hi - I'm needing some help with how to write a couple of lines of custom
> code to extract data to a variable.
>
> In the example below, I have a Button Click Event (in Part) activated set
> of code that pulls data from Vantage EpiDataView, and writes it to a text
> file. I'm happy with how it works, except I now want to add the field
> CurrentRate from the CurrRate table, for the CurrencyCode = AUD.
>
> I don't think I can use EpiDataView for this one can I? Do I need a foreign
> key view? Can someone please help me out with the code with this? I expect
> it's just a couple of lines I need to turn it into a variable. I have the
> Epicor Tools User Guide, but can't see a relevant section.
>
> Here's some of the working code that I'm already happy with:
>
> Private Sub btnAustralia1_Click(ByVal Sender As Object, ByVal Args As
> System.EventArgs) Handles btnAustralia1.Click
> Dim edvPart As EpiDataView = CType(oTrans.EpiDataViews("Part"),EpiDataView)
> Dim PartNum As String = edvPart.dataView(edvPart.Row)("PartNum")
> Dim PartDescription As String =
> edvPart.dataView(edvPart.Row)("PartDescription")
> Dim SalesUM As String = edvPart.dataView(edvPart.Row)("SalesUM")
> Dim UnitPrice As String = edvPart.dataView(edvPart.Row)("UnitPrice")
> system.threading.thread.sleep(600)
> Dim writeFile As System.IO.TextWriter = New _
> StreamWriter("c:\vantage_custom_swap003.txt")
> writeFile.WriteLine(PartNum)
> writeFile.WriteLine(PartDescription)
> writeFile.WriteLine(SalesUM)
> writeFile.WriteLine(UnitPrice)
> writeFile.WriteLine("EOF") '// EOF for End of File
> writeFile.Flush()
> writeFile.Close()
> writeFile = Nothing
> End Sub
>
>
> thanks kindly
> Kerry.
>
>
>


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