Parent/Child UD Tables Retrieved via UltraComboBoxes from Other

Rob,

You rock as always!

It was the "myHash.Add("UD102A",wClause)" that I needed to get the 'wClause' into the search.

Thanks,

NB

--- In vantage@yahoogroups.com, "Rob Bucek" <rbucek@...> wrote:
>
> Nathan,
>
>
>
> Here is a customization I wrote that I think fairly emulates what you're
> trying to do if I read that correctly. We have a root cause analysis
> report we do for late shipments to customers. Our account managers
> wanted a reason code, and for each reason code, a group of sub codes
> tied to the 'parent' code. I set up a UD parent child table to hold the
> parent codes and child table to hold the 'sub' codes. In addition just
> in case, you'll also set up one FKV for your child table in the data
> tools dialogue that you won't see in the code below. There are also
> some addition unrelated things going on in here you'll need to look past
> (such as the hash table I'm using for looking up crap on the part
> table). Hope this helps.
>
>
>
> 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 **
>
>
>
> Private WithEvents oTrans_adapter As EpiBaseAdapter
>
> Private UD102Adapter As UD102Adapter
>
>
>
> Sub InitializeCustomCode()
>
>
>
> UD102Adapter = New UD102Adapter(oTrans)
>
> UD102Adapter.BOConnect()
>
> oTrans_adapter = csm.TransAdaptersHT("oTrans_adapter")
>
>
>
> End Sub
>
>
>
> Private Sub FillUD102ACombo(Key1 as String)
>
> Dim myHash As System.Collections.Hashtable = New
> System.Collections.Hashtable()
>
> Dim wClause As String = "Key1= '" & Key1 & "'"
>
> myHash.Add("UD102A",wClause)
>
> 'MessageBox.show(wClause)
>
> Dim opts As SearchOptions =
> Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHash,DataSetM
> ode.RowsDataSet)
>
> ud102Adapter.InvokeSearch(opts)
>
> End sub
>
>
>
> Private Sub ucbSubReason_BeforeDropDown(ByVal Sender As Object,
> ByVal Args As System.ComponentModel.CancelEventArgs) Handles
> ucbSubReason.BeforeDropDown
>
> Dim edvUD09 As EpiDataView =
> CType(oTrans.EpiDataViews("UD09"),EpiDataView)
>
> Dim Key1 As String = edvUD09.dataView(edvUD09.Row)("ShortChar02")
>
> FillUD102ACombo(Key1)
>
> End Sub
>
>
>
> '// ** 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
>
> '// End Custom Method Calls
>
> 'End Sub
>
>
>
> Sub DestroyCustomCode()
>
> ud102Adapter.Dispose()
>
> ud102Adapter=Nothing
>
> oTrans_adapter = Nothing
>
> '// ** 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 oTrans_adapter_BeforeAdapterMethod(ByVal
> sender As object, ByVal args As BeforeAdapterMethodArgs) Handles
> oTrans_adapter.BeforeAdapterMethod
>
> '// ** Argument Properties and Uses **
>
> '// args.MethodName, args.Cancel
>
> '
>
> 'Add Event Handler Code
>
> '
>
> 'MessageBox.Show(args.MethodName) ' use this to find
> method
>
>
>
> Select Case args.MethodName
>
>
>
> Case "Update"
>
> Dim edvPart As EpiDataView =
> CType(oTrans.EpiDataViews("Part"),EpiDataView)
>
> Dim edvUD09 As EpiDataView =
> CType(oTrans.EpiDataViews("UD09"),EpiDataView)
>
> Dim strDesc As String =
> edvPart.dataView(edvPart.Row)("PartDescription")
>
> Dim txtKey1 as epitextbox =
> ctype(csm.GetNativeControlReference("46567b2e-6bc0-4967-be35-a0ec6843838
> f"),EpitextBox)
>
> Dim val As String = txtKey1.value
>
> Dim WhereCLause As String = "PartNum = '" + val + "'"
>
> Dim recSelected As Boolean
>
> Dim dsSearch As DataSet
>
> 'MessageBox.Show (strDesc)
>
> If (val <> String.Empty) Then
>
> dsSearch =
> Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"PartAdapt
> er",recselected,False,whereClause)
>
> If (recSelected = False) Then
>
> 'MessageBox.Show (val + "is not a valid part.")
>
> 'edvUD09.dataView(edvUD09.Row)("ShortChar01") = ""
>
> End If
>
> 'MessageBox.Show (val)
>
> edvUD09.dataView(edvUD09.Row)("ShortChar01") = strDesc
>
> End If
>
> 'Throw New UIException
>
>
>
> Case Else
>
>
>
> End Select
>
>
>
> End Sub
>
> Private Sub UD09Form_Load(ByVal sender As object, ByVal
> args As EventArgs) Handles UD09Form.Load
>
> '//
>
> '// Add Event Handler Code
>
> Dim fields As String() = New String(){"ChildKey1"}
>
> ucbSubReason.DataSource = ud102Adapter.UD102Data.UD102A
>
> ucbSubReason.ValueMember = "ChildKey1"
>
> ucbSubReason.DisplayMember = "ChildKey1"
>
> ucbSubReason.SetColumnFilter(fields)
>
> '//
>
> End Sub
>
>
>
>
>
>
>
>
>
> Private Sub ucbSubReason_ValueChanged(ByVal Sender As
> Object, ByVal Args As System.EventArgs) Handles
> ucbSubReason.ValueChanged
>
> '// ** Place Event Handling Code Here **
>
>
> Dim edvPart As EpiDataView =
> CType(oTrans.EpiDataViews("Part"),EpiDataView)
>
> Dim edvUD09 As EpiDataView =
> CType(oTrans.EpiDataViews("UD09"),EpiDataView)
>
> Dim strDesc As String =
> edvPart.dataView(edvPart.Row)("PartDescription")
>
> Dim txtKey1 as epitextbox =
> ctype(csm.GetNativeControlReference("46567b2e-6bc0-4967-be35-a0ec6843838
> f"),EpitextBox)
>
> Dim val As String = txtKey1.value
>
> Dim WhereCLause As String = "PartNum = '" + val + "'"
>
> Dim recSelected As Boolean
>
> Dim dsSearch As DataSet
>
> 'MessageBox.Show (strDesc)
>
> If (val <> String.Empty) Then
>
> dsSearch =
> Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"PartAdapt
> er",recselected,False,whereClause)
>
> If (recSelected = False) Then
>
> MessageBox.Show (val + "is not a valid part.")
>
>
>
> End If
>
> 'MessageBox.Show (val)
>
> edvUD09.dataView(edvUD09.Row)("ShortChar01") = strDesc
>
> End If
>
> 'Throw New UIException
>
> End Sub
>
>
>
> Rob Bucek
>
> Manufacturing Engineer
>
> PH: (715) 284-5376 ext 3111
>
> FAX: (715)284-4084
>
> <http://www.dsmfg.com/>
>
> (Click the logo to view our site) <http://www.dsmfg.com/>
>
>
>
>
>
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
> Of bonner.nathan
> Sent: Friday, November 06, 2009 11:08 AM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Parent/Child UD Tables Retrieved via UltraComboBoxes
> from Other Menues
>
>
>
>
>
> We are on 8.03.408B.
>
> I have setup a Parent / Child User Defined Table for Customers'
> "Industry" (Parent) and related "Segments" (Child). I want to use two UD
> Fields on Customer (ShortChar04 and ShortChar05) to hold these values
> returned via selections made from two Ultra Combo Boxes (UCB's).
>
> I have been able to get the Parent selections to appear correctly in the
> first UCB but am struggling to get the Child selections to filter
> correctly based on the Parent selection.
>
> The segment of my code that I suspect may be the problem is as follows
> and it is better use of the "wClause" that seems to be wanting:
>
> Private Sub FillUD101ACombo(key1 As String)
>
> Dim myHash As System.Collections.Hashtable = New
> System.Collections.Hashtable()
>
> Dim wClause As String = "Key1 = '" & Key1 & "'"
>
> 'MessageBox.Show("UD101A", wClause)
>
> Dim opts As SearchOptions =
> Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHash,DataSetM
> ode.RowsDataSet)
>
> ud101Adapter.InvokeSearch(opts)
>
> End Sub
>
> Any suggestions on how to pass the "wClause" to the Search to limit the
> returns?
>
> Thanks,
>
> NB
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
We are on 8.03.408B.

I have setup a Parent / Child User Defined Table for Customers' "Industry" (Parent) and related "Segments" (Child). I want to use two UD Fields on Customer (ShortChar04 and ShortChar05) to hold these values returned via selections made from two Ultra Combo Boxes (UCB's).

I have been able to get the Parent selections to appear correctly in the first UCB but am struggling to get the Child selections to filter correctly based on the Parent selection.

The segment of my code that I suspect may be the problem is as follows and it is better use of the "wClause" that seems to be wanting:

Private Sub FillUD101ACombo(key1 As String)

Dim myHash As System.Collections.Hashtable = New System.Collections.Hashtable()

Dim wClause As String = "Key1 = '" & Key1 & "'"

'MessageBox.Show("UD101A", wClause)

Dim opts As SearchOptions = Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHash,DataSetMode.RowsDataSet)

ud101Adapter.InvokeSearch(opts)

End Sub

Any suggestions on how to pass the "wClause" to the Search to limit the returns?

Thanks,

NB
Nathan,



Here is a customization I wrote that I think fairly emulates what you're
trying to do if I read that correctly. We have a root cause analysis
report we do for late shipments to customers. Our account managers
wanted a reason code, and for each reason code, a group of sub codes
tied to the 'parent' code. I set up a UD parent child table to hold the
parent codes and child table to hold the 'sub' codes. In addition just
in case, you'll also set up one FKV for your child table in the data
tools dialogue that you won't see in the code below. There are also
some addition unrelated things going on in here you'll need to look past
(such as the hash table I'm using for looking up crap on the part
table). Hope this helps.



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 **



Private WithEvents oTrans_adapter As EpiBaseAdapter

Private UD102Adapter As UD102Adapter



Sub InitializeCustomCode()



UD102Adapter = New UD102Adapter(oTrans)

UD102Adapter.BOConnect()

oTrans_adapter = csm.TransAdaptersHT("oTrans_adapter")



End Sub



Private Sub FillUD102ACombo(Key1 as String)

Dim myHash As System.Collections.Hashtable = New
System.Collections.Hashtable()

Dim wClause As String = "Key1= '" & Key1 & "'"

myHash.Add("UD102A",wClause)

'MessageBox.show(wClause)

Dim opts As SearchOptions =
Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHash,DataSetM
ode.RowsDataSet)

ud102Adapter.InvokeSearch(opts)

End sub



Private Sub ucbSubReason_BeforeDropDown(ByVal Sender As Object,
ByVal Args As System.ComponentModel.CancelEventArgs) Handles
ucbSubReason.BeforeDropDown

Dim edvUD09 As EpiDataView =
CType(oTrans.EpiDataViews("UD09"),EpiDataView)

Dim Key1 As String = edvUD09.dataView(edvUD09.Row)("ShortChar02")

FillUD102ACombo(Key1)

End Sub



'// ** 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

'// End Custom Method Calls

'End Sub



Sub DestroyCustomCode()

ud102Adapter.Dispose()

ud102Adapter=Nothing

oTrans_adapter = Nothing

'// ** 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 oTrans_adapter_BeforeAdapterMethod(ByVal
sender As object, ByVal args As BeforeAdapterMethodArgs) Handles
oTrans_adapter.BeforeAdapterMethod

'// ** Argument Properties and Uses **

'// args.MethodName, args.Cancel

'

'Add Event Handler Code

'

'MessageBox.Show(args.MethodName) ' use this to find
method



Select Case args.MethodName



Case "Update"

Dim edvPart As EpiDataView =
CType(oTrans.EpiDataViews("Part"),EpiDataView)

Dim edvUD09 As EpiDataView =
CType(oTrans.EpiDataViews("UD09"),EpiDataView)

Dim strDesc As String =
edvPart.dataView(edvPart.Row)("PartDescription")

Dim txtKey1 as epitextbox =
ctype(csm.GetNativeControlReference("46567b2e-6bc0-4967-be35-a0ec6843838
f"),EpitextBox)

Dim val As String = txtKey1.value

Dim WhereCLause As String = "PartNum = '" + val + "'"

Dim recSelected As Boolean

Dim dsSearch As DataSet

'MessageBox.Show (strDesc)

If (val <> String.Empty) Then

dsSearch =
Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"PartAdapt
er",recselected,False,whereClause)

If (recSelected = False) Then

'MessageBox.Show (val + "is not a valid part.")

'edvUD09.dataView(edvUD09.Row)("ShortChar01") = ""

End If

'MessageBox.Show (val)

edvUD09.dataView(edvUD09.Row)("ShortChar01") = strDesc

End If

'Throw New UIException



Case Else



End Select



End Sub

Private Sub UD09Form_Load(ByVal sender As object, ByVal
args As EventArgs) Handles UD09Form.Load

'//

'// Add Event Handler Code

Dim fields As String() = New String(){"ChildKey1"}

ucbSubReason.DataSource = ud102Adapter.UD102Data.UD102A

ucbSubReason.ValueMember = "ChildKey1"

ucbSubReason.DisplayMember = "ChildKey1"

ucbSubReason.SetColumnFilter(fields)

'//

End Sub









Private Sub ucbSubReason_ValueChanged(ByVal Sender As
Object, ByVal Args As System.EventArgs) Handles
ucbSubReason.ValueChanged

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


Dim edvPart As EpiDataView =
CType(oTrans.EpiDataViews("Part"),EpiDataView)

Dim edvUD09 As EpiDataView =
CType(oTrans.EpiDataViews("UD09"),EpiDataView)

Dim strDesc As String =
edvPart.dataView(edvPart.Row)("PartDescription")

Dim txtKey1 as epitextbox =
ctype(csm.GetNativeControlReference("46567b2e-6bc0-4967-be35-a0ec6843838
f"),EpitextBox)

Dim val As String = txtKey1.value

Dim WhereCLause As String = "PartNum = '" + val + "'"

Dim recSelected As Boolean

Dim dsSearch As DataSet

'MessageBox.Show (strDesc)

If (val <> String.Empty) Then

dsSearch =
Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"PartAdapt
er",recselected,False,whereClause)

If (recSelected = False) Then

MessageBox.Show (val + "is not a valid part.")



End If

'MessageBox.Show (val)

edvUD09.dataView(edvUD09.Row)("ShortChar01") = strDesc

End If

'Throw New UIException

End Sub



Rob Bucek

Manufacturing Engineer

PH: (715) 284-5376 ext 3111

FAX: (715)284-4084

<http://www.dsmfg.com/>

(Click the logo to view our site) <http://www.dsmfg.com/>





From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of bonner.nathan
Sent: Friday, November 06, 2009 11:08 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Parent/Child UD Tables Retrieved via UltraComboBoxes
from Other Menues





We are on 8.03.408B.

I have setup a Parent / Child User Defined Table for Customers'
"Industry" (Parent) and related "Segments" (Child). I want to use two UD
Fields on Customer (ShortChar04 and ShortChar05) to hold these values
returned via selections made from two Ultra Combo Boxes (UCB's).

I have been able to get the Parent selections to appear correctly in the
first UCB but am struggling to get the Child selections to filter
correctly based on the Parent selection.

The segment of my code that I suspect may be the problem is as follows
and it is better use of the "wClause" that seems to be wanting:

Private Sub FillUD101ACombo(key1 As String)

Dim myHash As System.Collections.Hashtable = New
System.Collections.Hashtable()

Dim wClause As String = "Key1 = '" & Key1 & "'"

'MessageBox.Show("UD101A", wClause)

Dim opts As SearchOptions =
Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHash,DataSetM
ode.RowsDataSet)

ud101Adapter.InvokeSearch(opts)

End Sub

Any suggestions on how to pass the "wClause" to the Search to limit the
returns?

Thanks,

NB





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