Return newest PO with vb.net search based on entry person

Ok, I got this thing to work. I hadn't tried to return the PO Number with the sortdescending option along with a searchfilter AND the PONum = callresult.tables(0).rows(0).Item("PONum"). It now works as expected.



________________________________
From: tkoch77 <tkoch77@...>
To: vantage@yahoogroups.com
Sent: Wednesday, November 9, 2011 12:03 PM
Subject: [Vantage] Return newest PO with vb.net search based on entry person

I have this code that almost does what I want it to. I have a filter on it to filter PO's by the entry person. The problem is I want to return the most recent PO. If I do PONum = callresult.tables(0).rows(0).Item("PONum") it returns the very first PO. and If I do it this way,

dim count as string = DirectCast(callResult, DataSet).Tables(0).Rows.Count
        PONum = callresult.tables(0).rows(count - 1).Item("PONum")

I dont get the newest PO, just the PO number that is 1 minus however many rows were returned based on how many matched that entry persons name.

Here is my entire snippet of code. As always any help very appreciated.

         Dim user as String = POSuggEntryForm.Session.UserID
         Dim PONum as string
         Dim existsProject As Boolean = False
         Dim opts2 As New SearchOptions(Epicor.Mfg.UI.Searches.SearchMode.AutoSearch)
         opts2.DataSetMode = DataSetMode.ListDataSet
         opts2.SortDescending = true
         opts2.PreLoadSearchFilter = "EntryPerson = '" + user + "'"
         Dim callResult As Object = ProcessCaller.LaunchSearch(POSuggEntryForm, "POAdapter", opts2)
      If(TypeOf callResult Is System.Data.DataSet) AndAlso (DirectCast(callResult, DataSet).Tables(0).Rows.Count > 0) Then
         dim count as string = DirectCast(callResult, DataSet).Tables(0).Rows.Count
        PONum = callresult.tables(0).rows(count - 1).Item("PONum")
         Dim opts As LaunchFormOptions = New LaunchFormOptions()
         With opts
            .ValueIn = PONum
         End With
         ProcessCaller.LaunchForm(oTrans, "PMGO2001",opts)
      End If

Thanks!

Ted



------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note:Â You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.%c2%a0
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links



[Non-text portions of this message have been removed]
I have this code that almost does what I want it to. I have a filter on it to filter PO's by the entry person. The problem is I want to return the most recent PO. If I do PONum = callresult.tables(0).rows(0).Item("PONum") it returns the very first PO. and If I do it this way,

dim count as string = DirectCast(callResult, DataSet).Tables(0).Rows.Count
PONum = callresult.tables(0).rows(count - 1).Item("PONum")

I dont get the newest PO, just the PO number that is 1 minus however many rows were returned based on how many matched that entry persons name.

Here is my entire snippet of code. As always any help very appreciated.

Dim user as String = POSuggEntryForm.Session.UserID
Dim PONum as string
Dim existsProject As Boolean = False
Dim opts2 As New SearchOptions(Epicor.Mfg.UI.Searches.SearchMode.AutoSearch)
opts2.DataSetMode = DataSetMode.ListDataSet
opts2.SortDescending = true
opts2.PreLoadSearchFilter = "EntryPerson = '" + user + "'"
Dim callResult As Object = ProcessCaller.LaunchSearch(POSuggEntryForm, "POAdapter", opts2)
If(TypeOf callResult Is System.Data.DataSet) AndAlso (DirectCast(callResult, DataSet).Tables(0).Rows.Count > 0) Then
dim count as string = DirectCast(callResult, DataSet).Tables(0).Rows.Count
PONum = callresult.tables(0).rows(count - 1).Item("PONum")
Dim opts As LaunchFormOptions = New LaunchFormOptions()
With opts
.ValueIn = PONum
End With
ProcessCaller.LaunchForm(oTrans, "PMGO2001",opts)
End If

Thanks!

Ted