Hi Brian - OK here's a fairly easy one that we do in Part Maintenance...
On the Revision tab, we have a button to launch a BOM Listing
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO
Imports System.IO '// Added this for file import/export
Private Sub BomListReport_Click(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles BomListReport.Click
'// ** Place Event Handling Code Here **
If File.Exists("c:\vantage_custom_swap002.txt") Then
File.Delete("c:\vantage_custom_swap002.txt")
system.threading.thread.sleep(400)
Else
End If
Try
Dim edvPart As EpiDataView = CType(oTrans.EpiDataViews("Part"),EpiDataView)
Dim PartNum As String = edvPart.dataView(edvPart.Row)("PartNum")
Dim edvPartRev As EpiDataView = CType(oTrans.EpiDataViews("PartRev"),EpiDataView)
Dim RevisionNum As String = edvPartRev.dataView(edvPartRev.Row)("RevisionNum")
Dim writeFile As System.IO.TextWriter = New _
StreamWriter("c:\vantage_custom_swap002.txt")
writeFile.WriteLine(PartNum)
writeFile.WriteLine(RevisionNum)
writeFile.WriteLine("EOF") '// EOF for End of File
writeFile.Flush()
writeFile.Close()
writeFile = Nothing
ProcessCaller.LaunchForm(oTrans, "Epicor.Mfg.UIRpt.BOMListingReport.dll")
system.threading.thread.sleep(200) '//0.2 second pause
Process.Start("V:\Vantage Macros\Populate BOM Listing Report.exe")
Catch
MsgBox("Error: Is a Part Number entered?")
End Try
End Sub
The AHK code for the file "Populate BOM Listing Report.exe" is as follows:
FileReadLine, StringPART, C:\vantage_custom_swap002.txt, 1
FileReadLine, StringREV, C:\vantage_custom_swap002.txt, 2
;IfWinNotActive, Bill Of Material Listing Report, , WinActivate, Bill Of Material Listing Report,
WinWaitActive, Bill Of Material Listing Report,
SetKeyDelay, 0
SetMouseDelay, 0
Sleep, 400
MouseClick, left, 85, 95
Sleep, 300
MouseClick, left, 67, 51
Sleep, 300
Send, {ALTDOWN}f{ALTUP}{HOME}{ENTER}
Sleep, 300
MouseClick, left, 63, 221
Sleep, 300
MouseClick, left, 76, 219
Sleep, 100
SendInput, %StringPART%
Sleep, 100
Send, {TAB}
Sleep, 100
SendInput, %StringREV%
Send, {TAB}
Yes, this AHK bit is a bit tacky - but is suitable for this low-risk operation. I'd usually try and eliminate Mouse clicks, and prefer to rely on keystrokes where possible - or more ideally reading the file data directly back in to fields from VB code.
We do use a few things like this, to link together different tasks and activities that are a bit awkward to access normally. One of my recent favorites is a couple of buttons we've added to Engineering Workbench, to recost by launching "ViewCosts", immediately killing it, and dumping the temp data to file - to be read back into Cost Adjustment.
Kerry.
--- In vantage@yahoogroups.com, "Brian W. Spolarich" <bspolarich@...> wrote:
>
> I wouldn't mind seeing an example of this!
>
> -----Original Message-----
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
> Of Kerry_Muntz
> Sent: Wednesday, February 09, 2011 2:25 PM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Re: 9.04 BPM passing parameters
>
> Or what you can do (what we do) is create a temporary ascii file on C
> drive (or wherever is appropriate), and write to it prior to calling the
> new window, and then read from it in the next. At the moment we write
> the data using custom code. You need to add a new import:
>
> Imports System.IO
>
> and then pull out some variables from EpiDataView, and writing them to a
> file, eg with writeFile.WriteLine(YourVariable)
>
> I cheat with putting the code back in. I have created a self-executing
> AutoHotKey code, that I call prior to calling the desired Vantage
> screen. The coded programme waits for the right screen, and then reads
> the newly created file, inputting whatever is needed.
>
> I'm happy to share more of an example if it helps. Long term I am
> intending to get rid of the AutoHotKey part - but right now it seems
> pretty robust, and flexible.
>
> This method assumes that the user has the right to write somewhere, eg
> C:\
>
> Kerry.
>
>
> --- In vantage@yahoogroups.com, "Kevin Simon" <ksimon@> wrote:
> >
> > Rather than a UD table, you could use a UD field on something specific
> to
> > that user. If you don't have userID's that people share, you could
> tie it
> > to the user table. In Job receipt, you update the user table, then
> you read
> > it in the GetNewLot method.
> >
> >
> >
> > Kevin Simon
> >
> >
> >
> > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On
> Behalf Of
> > reardon_kent
> > Sent: Wednesday, February 09, 2011 11:06 AM
> > To: vantage@yahoogroups.com
> > Subject: [Vantage] Re: 9.04 BPM passing parameters
> >
> >
> >
> >
> >
> > The problem is when I'm in Job Rcpt, I have the info I need to update
> the
> > Lot, but as soon as the Lot Attribute screen (GetNewLot method) is
> executed,
> > I no longer have access to the data in Job Rcpt and the Call Context
> Fields
> > have been cleared out. I thought about using a UD table to temporarily
> store
> > the data.
> >
> > --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
> "Kevin
> > Simon" <ksimon@> wrote:
> > >
> > > What about updating a UD field on the Lot with the data you want to
> pass,
> > as
> > > you are calling it? You could put the Job number, the customer
> number, or
> > > some other identifying field in the UD field.
> > >
> > >
> > >
> > > Kevin
> > >
> > >
> > >
> > > From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
> > [mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ]
> On
> > Behalf Of
> > > reardon_kent
> > > Sent: Tuesday, February 08, 2011 6:49 PM
> > > To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
> > > Subject: [Vantage] 9.04 BPM passing parameters
> > >
> > >
> > >
> > >
> > >
> > > Is there a way to pass parameters between transactions? I need to
> update a
> > > user defined field on the Lot Attributes screen based on the
> customer a
> > Lot
> > > is for. In this case, the lot screen is called from the Job Rcpt to
> > > Inventory. Based on the Job, I can figure out the customer, but once
> the
> > Lot
> > > screen is called the data is no longer available. Thought I could
> use the
> > > CallContextBPMData to pass the customer, but that looks like it gets
> > cleared
> > > out when the transaction changes. Any ideas?
> > >
> > >
> > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>
>
> ------------------------------------
>
> 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/.
> (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
>