Passing paramters to forms \ Interform comms

After digging through the site a little, I’ve seen a couple of these topics arise but I haven’t found a solution for my instance of the issue.

In a nutshell, I want pass a parameter to a form I am opening using ProcessCaller.Launch(oTrans, “MoveMtlScreen”, “JobNumber”). Note that I am using the proper form ID, and a real job.

The screen opens but I don’t get the job I want. I’ve read some old posts including @josecgomez and @rbucek where the solution was to pass in the proper parameters (in the proper order). Using this, I disassembled the MoveMtlForm and see that there are no expected parameters so I assume that method is out the window.

That being the case, how can communicate between forms. Even if I get a reference to the form I open, I can’t manipulate it (I assume because I cast an EpiForm, and it’s really a type of MoveMtlForm in namespace Erp.UI.App.MoveMaterialEntry which I don’t have access to)

That said, I need to get my selected job on the main MES screen, to this form I open - what are my options besides the caveman way of a text file written from main screen and read by second screen?

Have you looked into LaunchFormOptions? I use it to pass information between forms and start the new form with data.

Jim Rogers

Jim,

Thanks. I did but I couldn’t find anything relative to the MoveMtlRequestForm. I assume it’s because that form isn’t expecting any parameters. Here is what I a doing for a test:

LaunchFormOptions lfo = new LaunchFormOptions();
lfo.IsModal = true;
lfo.ValueIn = "cconn,F000007944";
EpiForm frm = (EpiForm)ProcessCaller.LaunchForm(oTrans, "DEGO1030",lfo);
```

I tried with EMP,,JOB and also just EMP, and just JOB

Hi Chris,

That is good for calling your form, but you will also need to add a customization, must be active on the DEGO1030 menu ID as well, and in that customization you will look at the LFO and tell the form what to do with it. Based on your description, you would populate the job number in the MoveMtlRequestForm.

Jim

1 Like

How do I access the LFO from the called form?

NM:

if (MoveMtlRequestForm.LaunchFormOptions != null)

{ 

// Grab LFO passed from parent form: 

string PassedValue = MoveMtlRequestForm.LaunchFormOptions.ContextValue.ToString();

}

Here is an example of using the LFO value in a form.
private void UD40Form_Load(object sender, EventArgs args)
{
// Add Event Handler Code
EpiDataView edvCallContextBpmData = ((EpiDataView)(this.oTrans.EpiDataViews[“CallContextBpmData”]));
if (UD40Form.LaunchFormOptions != null)
{
edvCallContextBpmData.dataView[0][“ShortChar01”] = Convert.ToString(UD40Form.LaunchFormOptions.ValueIn);
this.txtJobNum.Text = Convert.ToString(UD40Form.LaunchFormOptions.ValueIn);
txtJobNum_LostFocus(sender, args);
}
}

1 Like

Thanks, I ran into another issue where apparently the form was deleting the data I placed into the text box (after getting the lfo). I came up with an acceptable workaround though. I appreciate your help.