Order Search custom code

Hi Ken,

> Of course, there may be a simpler way for what I'm looking for, so here's
> what I need. We would like when a person enters an Order, to do a search on
> all other orders to see if that PO exists already.

I'm glad you got your code to work but just a note about this idea. The
trouble I've had with this kind of idea in the past is that not everyone
enters customer purchase orders the same way. You can get "PO-12321" or PO
1232 1" or even mixed case. So it's possible to look for an existing PO but
not find it because it was entered differently even if only slightly. The
other issue is that you could find a PO number but for a different customer
giving a false positive. Conversely, you may want to come up with some logic
would be needed to prevent orders coming from two different divisions (company
names) that are linked by a parent company as well.

Mark W.
Previously I've used searchadapters within custom code to look up data based on a where statement. I'd like to do this for OrderHed table, but apparently there is no OrderSearchAdapter. I'm hoping someone might offer me the slight push I need to get what I need.

Of course, there may be a simpler way for what I'm looking for, so here's what I need. We would like when a person enters an Order, to do a search on all other orders to see if that PO exists already. If it does, a warning should pop up, but it shouldn't prohibit them from continuing on. That is to say, some times we do have orders with duplicate PO's, but most times we don't. I know there is a duplicate PO check function in the system, but it's all or nothing. I need a warning message, not an error that prohibits them from entering a duplicate PO.

Here's my code, the problem I know I'm having is how do I search the previous SO's without an SOSearchAdapter:

Select Case args.Column.ColumnName

Case "PONum"

Dim edv As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)
dim PONumVal as string = edv.dataView(edv.row)("PONum")

dim recSelected as boolean
Dim whereClause as string ="PONum ='" & PONumVal & "'"
Dim dsPONum as DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"SalesOrderAdapter",recSelected,False,whereClause)
if PONumVal = CType(dsPONum.PONum, string) then
messagebox.show("PO Number Previously Issued")
end if

Thanks for any help. Most of this code I took from another place where I used (successfully) the JobOperSearchAdapter to return operations tied to a specific PO.

Thanks,
Ken


[Non-text portions of this message have been removed]
What Sub trapped event are you using to trigger the code?

I didn't replicate and test it (selecting my own event trigger) but the code doesn't look blatantly 'wrong' in any way.

Are you positive it is actually being triggered to process?

Rob Brown

Ken Williams <ken@...> wrote:
Previously I've used searchadapters within custom code to look up data based on a where statement. I'd like to do this for OrderHed table, but apparently there is no OrderSearchAdapter. I'm hoping someone might offer me the slight push I need to get what I need.

Of course, there may be a simpler way for what I'm looking for, so here's what I need. We would like when a person enters an Order, to do a search on all other orders to see if that PO exists already. If it does, a warning should pop up, but it shouldn't prohibit them from continuing on. That is to say, some times we do have orders with duplicate PO's, but most times we don't. I know there is a duplicate PO check function in the system, but it's all or nothing. I need a warning message, not an error that prohibits them from entering a duplicate PO.

Here's my code, the problem I know I'm having is how do I search the previous SO's without an SOSearchAdapter:

Select Case args.Column.ColumnName

Case "PONum"

Dim edv As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)
dim PONumVal as string = edv.dataView(edv.row)("PONum")

dim recSelected as boolean
Dim whereClause as string ="PONum ='" & PONumVal & "'"
Dim dsPONum as DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"SalesOrderAdapter",recSelected,False,whereClause)
if PONumVal = CType(dsPONum.PONum, string) then
messagebox.show("PO Number Previously Issued")
end if

Thanks for any help. Most of this code I took from another place where I used (successfully) the JobOperSearchAdapter to return operations tied to a specific PO.

Thanks,
Ken

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






---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

[Non-text portions of this message have been removed]
Yeah, my problem was that for some reason I was trying to do this in the "beforefieldchange" when I really needed to do it in the "afterfieldchange". I noticed this when it seemed to be one entry off, I would enter a duplicate no flag, no duplicate, flag and so on. Works like a charm now.

Here's the final code, note it is in the afterfieldchange:

Dim edv As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)
dim PONumVal as string = edv.dataView(edv.row)("PONum")

dim recSelected as boolean
Dim whereClause as string = "PONum = '" & PONumVal & "'"
Dim dsPONum as DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"SalesOrderAdapter",recSelected,False,whereClause)

if (recSelected) then
messagebox.show("Warning: PO Number Previously Issued")
end if


________________________________

From: vantage@yahoogroups.com on behalf of Robert Brown
Sent: Wed 12/26/2007 5:11 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Order Search custom code



What Sub trapped event are you using to trigger the code?

I didn't replicate and test it (selecting my own event trigger) but the code doesn't look blatantly 'wrong' in any way.

Are you positive it is actually being triggered to process?

Rob Brown

Ken Williams <ken@... <mailto:ken%40intermountainelectronics.com> > wrote:
Previously I've used searchadapters within custom code to look up data based on a where statement. I'd like to do this for OrderHed table, but apparently there is no OrderSearchAdapter. I'm hoping someone might offer me the slight push I need to get what I need.

Of course, there may be a simpler way for what I'm looking for, so here's what I need. We would like when a person enters an Order, to do a search on all other orders to see if that PO exists already. If it does, a warning should pop up, but it shouldn't prohibit them from continuing on. That is to say, some times we do have orders with duplicate PO's, but most times we don't. I know there is a duplicate PO check function in the system, but it's all or nothing. I need a warning message, not an error that prohibits them from entering a duplicate PO.

Here's my code, the problem I know I'm having is how do I search the previous SO's without an SOSearchAdapter:

Select Case args.Column.ColumnName

Case "PONum"

Dim edv As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)
dim PONumVal as string = edv.dataView(edv.row)("PONum")

dim recSelected as boolean
Dim whereClause as string ="PONum ='" & PONumVal & "'"
Dim dsPONum as DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"SalesOrderAdapter",recSelected,False,whereClause)
if PONumVal = CType(dsPONum.PONum, string) then
messagebox.show("PO Number Previously Issued")
end if

Thanks for any help. Most of this code I took from another place where I used (successfully) the JobOperSearchAdapter to return operations tied to a specific PO.

Thanks,
Ken

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

---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

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






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

After getting through the worst of a steep, long learning curve (still not done traversing it yet!) to get used to VB.NET and event driven object coding, I've found most problems I've inflicted upon myself were a result of not selecting the right event trigger (and being lazy by skipping the simple test of the event by triggering a simple 'hello world' messagebox inside the sub).

Skipped-steps/shortcuts always waste time in the long run. Maybe in a year or so I'll be confident enough in event behavior to 'take the shortcuts'. Until then, I've become fanatical about testing events before wasting a second on the guts of the code (as sometimes the event you are forced into using impacts how you have to code the 'guts').

Thanks for posting the working code.

Rob Brown

Ken Williams <ken@...> wrote:
Yeah, my problem was that for some reason I was trying to do this in the "beforefieldchange" when I really needed to do it in the "afterfieldchange". I noticed this when it seemed to be one entry off, I would enter a duplicate no flag, no duplicate, flag and so on. Works like a charm now.

Here's the final code, note it is in the afterfieldchange:

Dim edv As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)
dim PONumVal as string = edv.dataView(edv.row)("PONum")

dim recSelected as boolean
Dim whereClause as string = "PONum = '" & PONumVal & "'"
Dim dsPONum as DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"SalesOrderAdapter",recSelected,False,whereClause)

if (recSelected) then
messagebox.show("Warning: PO Number Previously Issued")
end if

________________________________

From: vantage@yahoogroups.com on behalf of Robert Brown
Sent: Wed 12/26/2007 5:11 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Order Search custom code

What Sub trapped event are you using to trigger the code?

I didn't replicate and test it (selecting my own event trigger) but the code doesn't look blatantly 'wrong' in any way.

Are you positive it is actually being triggered to process?

Rob Brown

Ken Williams <ken@... <mailto:ken%40intermountainelectronics.com> > wrote:
Previously I've used searchadapters within custom code to look up data based on a where statement. I'd like to do this for OrderHed table, but apparently there is no OrderSearchAdapter. I'm hoping someone might offer me the slight push I need to get what I need.

Of course, there may be a simpler way for what I'm looking for, so here's what I need. We would like when a person enters an Order, to do a search on all other orders to see if that PO exists already. If it does, a warning should pop up, but it shouldn't prohibit them from continuing on. That is to say, some times we do have orders with duplicate PO's, but most times we don't. I know there is a duplicate PO check function in the system, but it's all or nothing. I need a warning message, not an error that prohibits them from entering a duplicate PO.

Here's my code, the problem I know I'm having is how do I search the previous SO's without an SOSearchAdapter:

Select Case args.Column.ColumnName

Case "PONum"

Dim edv As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)
dim PONumVal as string = edv.dataView(edv.row)("PONum")

dim recSelected as boolean
Dim whereClause as string ="PONum ='" & PONumVal & "'"
Dim dsPONum as DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"SalesOrderAdapter",recSelected,False,whereClause)
if PONumVal = CType(dsPONum.PONum, string) then
messagebox.show("PO Number Previously Issued")
end if

Thanks for any help. Most of this code I took from another place where I used (successfully) the JobOperSearchAdapter to return operations tied to a specific PO.

Thanks,
Ken

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

---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

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

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






---------------------------------
Never miss a thing. Make Yahoo your homepage.

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