Vantage/VB Newbie: Customization script review. Open to suggesti

If I'm understanding correctly...If you want to populate data from the UD table into the Part Table I would call to the Part Adapter from the form you fill in the UD information and store it in the respective fields. I would then use EpiDataView Notification Event in the Part form NotifyType.Initialize to View the data on the Part form. Let me know if this makes sense.

Drew

--- In vantage@yahoogroups.com, "bjcracosta" <racosta@...> wrote:
>
> Goal: Populate Part.ShortChar02, Part.ShortChar03, Part.ShortChar07,
> Part.ShortChar08 and Part.ShortChar09 with UD10.Key1, UD10.Character01,
> UD10.ShortChar01, UD10.ShortChar02 and UD10.ShortChar03. Table UD10
> contains bill-of-lading code details. And, display all the details in
> the part maintenance panel.
>
> While the following script works, it may not be the right or best way to
> achieve the goals.
>
> Thanks,
> Reggie Acosta
>
> '//**************************************************
> '// Custom VB.NET code for PartForm
> '// Created: 10/16/2008 11:32:33 AM
> '//**************************************************
> '// Change history:
> '//**************************************************
> '// ID Pgmr Date Description
> '// ---- --- -------- ------------------------------
> '// XXXX XXX MM/DD/YY XXXXXXXXXXXXXXXXXXXXXXXXXXX...
> '// E19 RRA 2/18/09 Enable capture of BOL Code and display BOL code
> information.
> '// E19 o Hid lblEpiCustom1 and txtEpiCustom1 by adding
> -1000 to x location coordinate.
> '// E19 o Changed lblNetVolume.Text from "Unit Net
> Volume" to "Cube Dimension".
> '// E19 o Blanked eneNetVolume.EpiLabel property value.
> It was "lblNetVolume".
> '// E19 o Added GroupBox for "BOL Code Information"
> '// E19 - Added UltraCombo bound to Part.ShortChar02
> which will store BOL Code from UD10.Key1.
> '// E19 - Added TextBox's to display Part fields
> ShortChar02, ShortChar07, ShortChar08 and ShortChar09.
> '// E19 (BOL Code, Shipping Class, Pack Class and
> NMFC#, respectively).
> '// E19 o Added assemblies: Epicor.Mfg.AD.UD10
> '// E19 Epicor.Mfg.IF.IUD10
> '// E19 for access to UD10Adapter.
> '//**************************************************
> Imports System
> Imports System.Data
> Imports System.Diagnostics
> Imports System.Windows.Forms
> Imports System.ComponentModel
> Imports Microsoft.VisualBasic
> Imports Epicor.Mfg.UI
> Imports Epicor.Mfg.UI.FrameWork
> Imports Epicor.Mfg.UI.ExtendedProps
> Imports Epicor.Mfg.UI.FormFunctions
> Imports Epicor.Mfg.UI.Customization
> Imports Epicor.Mfg.UI.Adapters
> Imports Epicor.Mfg.UI.Searches
> Imports Epicor.Mfg.BO
>
>
>
> Module Script
>
>
> '// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard
> Added Module Level Variables' Comments! **
> '// Begin Wizard Added Module Level Variables **
>
>
> '// End Wizard Added Module Level Variables **
>
>
> '// Add Custom Module Level Variables Here **
>
>
>
> Sub InitializeCustomCode()
>
> '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard
> Added Variable Intialization' lines **
> '// Begin Wizard Added Variable Intialization
>
>
> '// End Wizard Added Variable Intialization
> '// Begin Custom Method Calls
>
> '// <E19>
> SetExtendedProps()
> '// </E19>
>
> '// End Custom Method Calls
> End Sub
>
> '// <E19>
> Private Sub SetExtendedProps()
> '// Customization to set extended properties
> Dim edvPart As EpiDataView = CType(oTrans.EpiDataViews("Part"),
> EpiDataView)
> Dim txtBolCode As EpiTextBox =
> CType(csm.getNativeControlReference("0baaaee2-368a-4b18-966c-a0a92f98b42\
> 7"), EpiTextBox)
>
> If edvPart.dataView.Table.Columns.Contains("ShortChar02") Then
> txtBolCode.ReadOnly = True
> txtBolCode.Enabled = False
> End if
> If edvPart.dataView.Table.Columns.Contains("ShortChar07") Then
>
> edvPart.dataView.Table.Columns("ShortChar07").ExtendedProperties("ReadOn\
> ly") = True
>
> '//edvPart.dataView.Table.Columns("ShortChar07").ExtendedProperties("Ena\
> bled") = False
> End if
> If edvPart.dataView.Table.Columns.Contains("ShortChar08") Then
>
> edvPart.dataView.Table.Columns("ShortChar08").ExtendedProperties("ReadOn\
> ly") = True
>
> '//edvPart.dataView.Table.Columns("ShortChar08").ExtendedProperties("Ena\
> bled") = False
> End if
> If edvPart.dataView.Table.Columns.Contains("ShortChar09") Then
>
> edvPart.dataView.Table.Columns("ShortChar09").ExtendedProperties("ReadOn\
> ly") = True
>
> '//edvPart.dataView.Table.Columns("ShortChar09").ExtendedProperties("Ena\
> bled") = False
> End if
> End Sub
> '// </E19>
>
> Sub DestroyCustomCode()
>
>
> '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard
> Added Object Disposal' lines **
> '// Begin Wizard Added Object Disposal
>
>
> '// End Wizard Added Object Disposal
> '// Begin Custom Code Disposal
>
> '// End Custom Code Disposal
> End Sub
>
>
>
>
> Private Sub Part_AfterFieldChange(ByVal sender As object, ByVal args
> As DataColumnChangeEventArgs) Handles Part_Column.ColumnChanged
> '// ** Argument Properties and Uses **
> '// args.Row("[FieldName]")
> '// args.Column, args.ProposedValue, args.Row
> '
> 'Add Event Handler Code
> '
> Select Case args.Column.ColumnName
>
> Case "ShortChar02"
> '// <E19> Capture BOL Code information into Part table
> Dim edvPart As EpiDataView =
> CType(oTrans.EpiDataViews("Part"), EpiDataView)
> Dim UD10adapter As UD10Adapter = New
> UD10Adapter(PartForm)
> UD10adapter.BOConnect()
> Dim blnUD10 As Boolean =
> UD10adapter.GetByID(args.ProposedValue, "", "", "", "")
>
> Dim strBolDescr As String
> Dim strShipClass As String
> Dim strPackClass As String
> Dim strNmfcNbr As String
>
> If blnUD10 = True Then
> '// Copy BOL description, shipping class, pack class
> and NMFC#
> strBolDescr =
> UD10adapter.UD10Data.UD10.Rows(0)("Character01")
> strShipClass =
> UD10adapter.UD10Data.UD10.Rows(0)("ShortChar01")
> strPackClass =
> UD10adapter.UD10Data.UD10.Rows(0)("ShortChar02")
> strNmfcNbr =
> UD10adapter.UD10Data.UD10.Rows(0)("ShortChar03")
> Else
> strBolDescr = ""
> strShipClass = ""
> strPackClass = ""
> strNmfcNbr = ""
> End If
>
> '// Copy BOL description, shipping class, pack class and
> NMFC# into Part table
> edvPart.dataView(0)("ShortChar03") = strBolDescr
> edvPart.dataView(0)("ShortChar07") = strShipClass
> edvPart.dataView(0)("ShortChar08") = strPackClass
> edvPart.dataView(0)("ShortChar09") = strNmfcNbr
> edvPart.Notify(New EpiNotifyArgs(PartForm, edvPart.Row,
> edvPart.Column))
>
> UD10adapter.Dispose()
> '// </E19>
>
> Case Else
>
> End Select
>
> End Sub
>
> End Module
>
Goal: Populate Part.ShortChar02, Part.ShortChar03, Part.ShortChar07,
Part.ShortChar08 and Part.ShortChar09 with UD10.Key1, UD10.Character01,
UD10.ShortChar01, UD10.ShortChar02 and UD10.ShortChar03. Table UD10
contains bill-of-lading code details. And, display all the details in
the part maintenance panel.

While the following script works, it may not be the right or best way to
achieve the goals.

Thanks,
Reggie Acosta

'//**************************************************
'// Custom VB.NET code for PartForm
'// Created: 10/16/2008 11:32:33 AM
'//**************************************************
'// Change history:
'//**************************************************
'// ID Pgmr Date Description
'// ---- --- -------- ------------------------------
'// XXXX XXX MM/DD/YY XXXXXXXXXXXXXXXXXXXXXXXXXXX...
'// E19 RRA 2/18/09 Enable capture of BOL Code and display BOL code
information.
'// E19 o Hid lblEpiCustom1 and txtEpiCustom1 by adding
-1000 to x location coordinate.
'// E19 o Changed lblNetVolume.Text from "Unit Net
Volume" to "Cube Dimension".
'// E19 o Blanked eneNetVolume.EpiLabel property value.
It was "lblNetVolume".
'// E19 o Added GroupBox for "BOL Code Information"
'// E19 - Added UltraCombo bound to Part.ShortChar02
which will store BOL Code from UD10.Key1.
'// E19 - Added TextBox's to display Part fields
ShortChar02, ShortChar07, ShortChar08 and ShortChar09.
'// E19 (BOL Code, Shipping Class, Pack Class and
NMFC#, respectively).
'// E19 o Added assemblies: Epicor.Mfg.AD.UD10
'// E19 Epicor.Mfg.IF.IUD10
'// E19 for access to UD10Adapter.
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO



Module Script


'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard
Added Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **


'// End Wizard Added Module Level Variables **


'// Add Custom Module Level Variables Here **



Sub InitializeCustomCode()

'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard
Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization


'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls

'// <E19>
SetExtendedProps()
'// </E19>

'// End Custom Method Calls
End Sub

'// <E19>
Private Sub SetExtendedProps()
'// Customization to set extended properties
Dim edvPart As EpiDataView = CType(oTrans.EpiDataViews("Part"),
EpiDataView)
Dim txtBolCode As EpiTextBox =
CType(csm.getNativeControlReference("0baaaee2-368a-4b18-966c-a0a92f98b42\
7"), EpiTextBox)

If edvPart.dataView.Table.Columns.Contains("ShortChar02") Then
txtBolCode.ReadOnly = True
txtBolCode.Enabled = False
End if
If edvPart.dataView.Table.Columns.Contains("ShortChar07") Then

edvPart.dataView.Table.Columns("ShortChar07").ExtendedProperties("ReadOn\
ly") = True

'//edvPart.dataView.Table.Columns("ShortChar07").ExtendedProperties("Ena\
bled") = False
End if
If edvPart.dataView.Table.Columns.Contains("ShortChar08") Then

edvPart.dataView.Table.Columns("ShortChar08").ExtendedProperties("ReadOn\
ly") = True

'//edvPart.dataView.Table.Columns("ShortChar08").ExtendedProperties("Ena\
bled") = False
End if
If edvPart.dataView.Table.Columns.Contains("ShortChar09") Then

edvPart.dataView.Table.Columns("ShortChar09").ExtendedProperties("ReadOn\
ly") = True

'//edvPart.dataView.Table.Columns("ShortChar09").ExtendedProperties("Ena\
bled") = False
End if
End Sub
'// </E19>

Sub DestroyCustomCode()


'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard
Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal


'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal

'// End Custom Code Disposal
End Sub




Private Sub Part_AfterFieldChange(ByVal sender As object, ByVal args
As DataColumnChangeEventArgs) Handles Part_Column.ColumnChanged
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Select Case args.Column.ColumnName

Case "ShortChar02"
'// <E19> Capture BOL Code information into Part table
Dim edvPart As EpiDataView =
CType(oTrans.EpiDataViews("Part"), EpiDataView)
Dim UD10adapter As UD10Adapter = New
UD10Adapter(PartForm)
UD10adapter.BOConnect()
Dim blnUD10 As Boolean =
UD10adapter.GetByID(args.ProposedValue, "", "", "", "")

Dim strBolDescr As String
Dim strShipClass As String
Dim strPackClass As String
Dim strNmfcNbr As String

If blnUD10 = True Then
'// Copy BOL description, shipping class, pack class
and NMFC#
strBolDescr =
UD10adapter.UD10Data.UD10.Rows(0)("Character01")
strShipClass =
UD10adapter.UD10Data.UD10.Rows(0)("ShortChar01")
strPackClass =
UD10adapter.UD10Data.UD10.Rows(0)("ShortChar02")
strNmfcNbr =
UD10adapter.UD10Data.UD10.Rows(0)("ShortChar03")
Else
strBolDescr = ""
strShipClass = ""
strPackClass = ""
strNmfcNbr = ""
End If

'// Copy BOL description, shipping class, pack class and
NMFC# into Part table
edvPart.dataView(0)("ShortChar03") = strBolDescr
edvPart.dataView(0)("ShortChar07") = strShipClass
edvPart.dataView(0)("ShortChar08") = strPackClass
edvPart.dataView(0)("ShortChar09") = strNmfcNbr
edvPart.Notify(New EpiNotifyArgs(PartForm, edvPart.Row,
edvPart.Column))

UD10adapter.Dispose()
'// </E19>

Case Else

End Select

End Sub

End Module