Help with Custom Code - Looping Through Two Lookups to Get Data

Circling back here, this advice was spot on. Thank you!
Ken Williams
Vice President, Administrative Services
Intermountain Electronics - Power, Automation, and Process Systems
Office:Â 435-613-4817Â |Â Â Mobile:Â 801-918-7318
kwilliams@...www.ie-corp.com


On Thu, May 19, 2016 at 6:20 PM, Bernie Walker bwalker@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>

I basically had to do the same thing, but I crafted a BAQ to return the columns I wanted and then called Dynamic Query passing the Part Number – minimal code J

Â

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Thursday, May 19, 2016 12:12 PM
To: vantage
Subject: [Vantage] Help with Custom Code - Looping Through Two Lookups to Get Data in a Drop Down

Â




I'd like to publish a drop down of potential manufacturers in Job Entry based on our part #. This requires I go through two lookups, one to find the Mfg Cross Ref (PartXRefMfg) and a second to find the Mfg name (Manufacturer).

Â

I've got code that does this, but I can't get a full list. I need some sort of while loop, but I'm struggling with how to get that to work.

Â

Here's my code, any help would be greatly appreciated. It's in a weird state where I was trying to force the second row, but I'm lost on how to add to the current hashtable. This is the last piece of a very long puzzle I've put together, your help is greatly appreciated.

Â

Â

Private Sub FillMfgDropDownCombo(PartNum As String)

dim recSelected as boolean

dim whereClause as string ="PartNum ='" & PartNum & "'"

Dim dsMfgPart as DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"PartXRefMfgAdapter",recSelected,False,whereClause)

If recselected

Dim MfgNum as integer

MfgNum = dsMfgPart.Tables(0).Rows(0)("MfgNum")

Â

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

Dim whereClauseMfgID As String = String.Empty

If Not (String.IsNullOrEmpty(MfgNum)) Then

whereClauseMfgID = "MfgNum =" & MfgNum & ""

End If

myHashMfgID.Add("Manufacturer", whereClauseMfgID)

Dim optsMfgID As SearchOptions = Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHashMfgID,DataSetMode.RowsDataSet)

Â

MfgNum = dsMfgPart.Tables(0).Rows(1)("MfgNum")

Â

If Not (String.IsNullOrEmpty(MfgNum)) Then

whereClauseMfgID = "MfgNum =" & MfgNum & ""

End If

optsMfgID = Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHashMfgID,DataSetMode.RowsDataSet)

Â

ManufacturerAdapter.InvokeSearch(optsMfgID)

End If

End Sub


Ken Williams
Vice President, Administrative Services
Intermountain Electronics - Power, Automation, and Process Systems
Office:Â 435-613-4817Â |Â Â Mobile:Â 801-918-7318
kwilliams@...www.ie-corp.com




</div>
 


<div style="color:#fff;min-height:0;"></div>

I'd like to publish a drop down of potential manufacturers in Job Entry based on our part #. This requires I go through two lookups, one to find the Mfg Cross Ref (PartXRefMfg) and a second to find the Mfg name (Manufacturer).

I've got code that does this, but I can't get a full list. I need some sort of while loop, but I'm struggling with how to get that to work.

Here's my code, any help would be greatly appreciated. It's in a weird state where I was trying to force the second row, but I'm lost on how to add to the current hashtable. This is the last piece of a very long puzzle I've put together, your help is greatly appreciated.


Private Sub FillMfgDropDownCombo(PartNum As String)
dim recSelected as boolean
dim whereClause as string ="PartNum ='" & PartNum & "'"
Dim dsMfgPart as DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"PartXRefMfgAdapter",recSelected,False,whereClause)
If recselected
Dim MfgNum as integer
MfgNum = dsMfgPart.Tables(0).Rows(0)("MfgNum")

Dim myHashMfgID As System.Collections.Hashtable = New System.Collections.Hashtable()
Dim whereClauseMfgID As String = String.Empty
If Not (String.IsNullOrEmpty(MfgNum)) Then
whereClauseMfgID = "MfgNum =" & MfgNum & ""
End If
myHashMfgID.Add("Manufacturer", whereClauseMfgID)
Dim optsMfgID As SearchOptions = Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHashMfgID,DataSetMode.RowsDataSet)

MfgNum = dsMfgPart.Tables(0).Rows(1)("MfgNum")

If Not (String.IsNullOrEmpty(MfgNum)) Then
whereClauseMfgID = "MfgNum =" & MfgNum & ""
End If
optsMfgID = Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHashMfgID,DataSetMode.RowsDataSet)

ManufacturerAdapter.InvokeSearch(optsMfgID)
End If
End Sub

Ken Williams
Vice President, Administrative Services
Intermountain Electronics - Power, Automation, and Process Systems
Office:Â 435-613-4817Â |Â Â Mobile:Â 801-918-7318
kwilliams@...www.ie-corp.com

I basically had to do the same thing, but I crafted a BAQ to return the columns I wanted and then called Dynamic Query passing the Part Number – minimal code J

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Thursday, May 19, 2016 12:12 PM
To: vantage
Subject: [Vantage] Help with Custom Code - Looping Through Two Lookups to Get Data in a Drop Down

 




I'd like to publish a drop down of potential manufacturers in Job Entry based on our part #.  This requires I go through two lookups, one to find the Mfg Cross Ref (PartXRefMfg) and a second to find the Mfg name (Manufacturer).

 

I've got code that does this, but I can't get a full list.  I need some sort of while loop, but I'm struggling with how to get that to work.

 

Here's my code, any help would be greatly appreciated.  It's in a weird state where I was trying to force the second row, but I'm lost on how to add to the current hashtable.  This is the last piece of a very long puzzle I've put together, your help is greatly appreciated.

 

 

Private Sub FillMfgDropDownCombo(PartNum As String)

dim recSelected as boolean

dim whereClause as string ="PartNum ='" & PartNum & "'"

Dim dsMfgPart as DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"PartXRefMfgAdapter",recSelected,False,whereClause)

If recselected

Dim MfgNum as integer

MfgNum = dsMfgPart.Tables(0).Rows(0)("MfgNum")

 

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

Dim whereClauseMfgID As String = String.Empty

If Not (String.IsNullOrEmpty(MfgNum)) Then

whereClauseMfgID = "MfgNum =" & MfgNum & ""

End If

myHashMfgID.Add("Manufacturer", whereClauseMfgID)

Dim optsMfgID As SearchOptions = Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHashMfgID,DataSetMode.RowsDataSet)

 

MfgNum = dsMfgPart.Tables(0).Rows(1)("MfgNum")

 

If Not (String.IsNullOrEmpty(MfgNum)) Then

whereClauseMfgID = "MfgNum =" & MfgNum & ""

End If

optsMfgID = Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHashMfgID,DataSetMode.RowsDataSet)

 

ManufacturerAdapter.InvokeSearch(optsMfgID)

End If

End Sub


Ken Williams
Vice President, Administrative Services
Intermountain Electronics - Power, Automation, and Process Systems
Office: 435-613-4817 |  Mobile: 801-918-7318
kwilliams@...www.ie-corp.com