I'm trying to put default value to two check box fields (Web Saleable & Use part Rev) when adding new part. It seems like the condition on args.NotifyType inside edvPart_EpiViewNotification never meet. Do you see anything wrong in my code below?
Module Script
'// Begin Wizard Added Module Level Variables **
Private WithEvents oTrans_adapter As EpiBaseAdapter
Private WithEvents edvPart As EpiDataView
'// 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 Initialization' lines **
'// Begin Wizard Added Variable Initialization
oTrans_adapter = csm.TransAdaptersHT("oTrans_adapter")
AddHandler oTrans_adapter.BeforeAdapterMethod, AddressOf oTrans_adapter_BeforeAdapterMethod
AddHandler oTrans_adapter.AfterAdapterMethod, AddressOf oTrans_adapter_AfterAdapterMethod
edvPart = CType(oTrans.EpiDataViews("Part"), EpiDataView)
AddHandler edvPart.EpiViewNotification, AddressOf edvPart_EpiViewNotification
'// End Wizard Added Variable Initialization
'// Begin Wizard Added Custom Method Calls
edvPart = CType(oTrans.EpiDataViews("Part"), EpiDataView)
'// End Wizard Added Custom Method Calls
End Sub
Sub DestroyCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal
RemoveHandler oTrans_adapter.BeforeAdapterMethod, AddressOf oTrans_adapter_BeforeAdapterMethod
RemoveHandler oTrans_adapter.AfterAdapterMethod, AddressOf oTrans_adapter_AfterAdapterMethod
oTrans_adapter = Nothing
RemoveHandler edvPart.EpiViewNotification, AddressOf edvPart_EpiViewNotification
edvPart = Nothing
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
'// End Custom Code Disposal
End Sub
Private Sub edvPart_EpiViewNotification(ByVal view As EpiDataView, ByVal args As EpiNotifyArgs)
'** Argument Properties and Uses **
'view.dataView(args.Row)("[FieldName]")
'args.Row, args.Column, args.Sender, args.NotifyType
If (args.NotifyType = EpiTransaction.NotifyType.AddRow) Then
If (args.Row > -1) Then
Dim partView As EpiDataView = CType(oTrans.EpiDataViews("Part"),
EpiDataView)
partView .dataView(partView.Row)("WebPart") = "TRUE"
partView.dataView(partView.Row)("UsePartRev") = "FALSE"
End If
End If
End Sub
Module Script
'// Begin Wizard Added Module Level Variables **
Private WithEvents oTrans_adapter As EpiBaseAdapter
Private WithEvents edvPart As EpiDataView
'// 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 Initialization' lines **
'// Begin Wizard Added Variable Initialization
oTrans_adapter = csm.TransAdaptersHT("oTrans_adapter")
AddHandler oTrans_adapter.BeforeAdapterMethod, AddressOf oTrans_adapter_BeforeAdapterMethod
AddHandler oTrans_adapter.AfterAdapterMethod, AddressOf oTrans_adapter_AfterAdapterMethod
edvPart = CType(oTrans.EpiDataViews("Part"), EpiDataView)
AddHandler edvPart.EpiViewNotification, AddressOf edvPart_EpiViewNotification
'// End Wizard Added Variable Initialization
'// Begin Wizard Added Custom Method Calls
edvPart = CType(oTrans.EpiDataViews("Part"), EpiDataView)
'// End Wizard Added Custom Method Calls
End Sub
Sub DestroyCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal
RemoveHandler oTrans_adapter.BeforeAdapterMethod, AddressOf oTrans_adapter_BeforeAdapterMethod
RemoveHandler oTrans_adapter.AfterAdapterMethod, AddressOf oTrans_adapter_AfterAdapterMethod
oTrans_adapter = Nothing
RemoveHandler edvPart.EpiViewNotification, AddressOf edvPart_EpiViewNotification
edvPart = Nothing
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
'// End Custom Code Disposal
End Sub
Private Sub edvPart_EpiViewNotification(ByVal view As EpiDataView, ByVal args As EpiNotifyArgs)
'** Argument Properties and Uses **
'view.dataView(args.Row)("[FieldName]")
'args.Row, args.Column, args.Sender, args.NotifyType
If (args.NotifyType = EpiTransaction.NotifyType.AddRow) Then
If (args.Row > -1) Then
Dim partView As EpiDataView = CType(oTrans.EpiDataViews("Part"),
EpiDataView)
partView .dataView(partView.Row)("WebPart") = "TRUE"
partView.dataView(partView.Row)("UsePartRev") = "FALSE"
End If
End If
End Sub