Launch Form

Dear Experts, We have created the custom multilevel “PO Approval” screen similar to base “PO Approval” screen refer to below screen

.

On “View PO” custom button we are opening the Purchase Order Entry form and passing the PO value in LaunchFormOptions refer to below code

LaunchFormOptions objLounch = new LaunchFormOptions();
objLounch.ValueIn = Convert.ToString(txtPONum.Text);
objLounch.IsModal = false;
ProcessCaller.LaunchForm(oTrans,"PMGO2001", objLounch, true);

In PO Entry Form Load event we have written the below code

POAdapter objPO = new POAdapter(oTrans);
		objPO.BOConnect(); 
		if (POEntryForm.LaunchFormOptions != null) 
		{ 
			if (POEntryForm.LaunchFormOptions.ValueIn != null) 
			{ 
				string PONum = Convert.ToString(POEntryForm.LaunchFormOptions.ValueIn); 
				if (objPO.GetByID(PONum) == true) 
				{ 
					SearchOptions searchOpts = new SearchOptions(SearchMode.AutoSearch); 
					bool blnMorePages = true; 
					searchOpts.DataSetMode = DataSetMode.RowsDataSet; 
					searchOpts.PreLoadSearchFilter = "PONum = " + PONum; 
					oTrans.InvokeSearch(searchOpts); 
					objPO.GetRows(searchOpts, out blnMorePages); 
					searchOpts = null; 
				} 
			} 
		}

Now the problem is that, We have multiple PO’s pending for approval. like 50160, 50161… so on.
Approver clicked on custom “View PO” button to see the PO(50160) and PO form will open with data 50160 working fine

But when the approver second time clicked on “View PO” button to view next PO Order 50161 then PO Entry form is not loading with data of 50161 untill and unless we do not close the PO form.

Can you please let me know, how to replace the value in PO Entry form without closing the form?

Your code on the PO Entry Form to load the PO Details is written under Load event, this event only triggers while the form is being loaded first time,
You need to move this code in EpiViewNotification Event or something else.

sya

Try the Form.Activated event.

Same result on Form_Activate event.

Have you try oTrans.Refresh (just in case). Do you still see old values? If you click on the dropdown besides the binocular, do you see your added PO? If that’s the case, activate the the new row via code.
You could clear your dataset prior invoking the Invoke on oTrans if nothing works.

Yes, I have tried oTrans.Refresh but same result. I have clicked on the dropdown beside the binocular only one order is displaying refer to below screen

Hari,

I haven’t written Activate event, I suggested Activated. So, try

// End Wizard Added Custom Method Calls
POEntryForm.Activated += POEntryForm_Activated;

(…)
private void POEntryForm_Activated(object sender, EventArgs args)
{
// Add Event Handler Code
POAdapter objPO = new POAdapter(oTrans);
objPO.BOConnect();
if (POEntryForm.LaunchFormOptions != null)
{
if (POEntryForm.LaunchFormOptions.ValueIn != null)
{
string PONum = Convert.ToString(POEntryForm.LaunchFormOptions.ValueIn);
if (objPO.GetByID(PONum) == true) → Why?
{
SearchOptions searchOpts = new SearchOptions(SearchMode.AutoSearch);
bool blnMorePages = true;
searchOpts.DataSetMode = DataSetMode.RowsDataSet;
searchOpts.PreLoadSearchFilter = "PONum = " + PONum;
oTrans.InvokeSearch(searchOpts);
oTrans.Refresh();
//objPO.GetRows(searchOpts, out blnMorePages); → Why?
searchOpts = null;
}
}
}
}
EDIT.
Can’t properly format my post…hummm

1 Like

FWIW This Solution worked for me!
From the PO Entry Customization:

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization


		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls
		POEntryForm.Activated += POEntryForm_Activated;
	}


	private void POEntryForm_Activated(object sender, EventArgs args)
		{
			// Add Event Handler Code
			POAdapter objPO = new POAdapter(oTrans);
			objPO.BOConnect();
			if (POEntryForm.LaunchFormOptions != null)
			{
				if (POEntryForm.LaunchFormOptions.ValueIn != null)
				{
					string PONum = Convert.ToString(POEntryForm.LaunchFormOptions.ValueIn);
					if (objPO.GetByID(PONum) == true)
					{
						SearchOptions searchOpts = new SearchOptions(SearchMode.AutoSearch);
						bool blnMorePages = true;
						searchOpts.DataSetMode = DataSetMode.RowsDataSet;
						searchOpts.PreLoadSearchFilter = "PONum = " + PONum;
						oTrans.InvokeSearch(searchOpts);
						oTrans.Refresh();
						searchOpts = null;
					}
				}
			}
		}

In my custom form:

	private void epiButtonC1_Click(object sender, System.EventArgs args)
	{
		EpiDataView edvPrintedPOs = (EpiDataView)(oTrans.EpiDataViews["V_POs_Printed_1View"]);
		string myPONum = edvPrintedPOs.dataView[edvPrintedPOs.Row]["POHeader_PONum"].ToString();

		LaunchFormOptions objLounch = new LaunchFormOptions();
		objLounch.ValueIn = Convert.ToString(myPONum);
		objLounch.IsModal = false;
		ProcessCaller.LaunchForm(oTrans,"PMGO2001", objLounch, true);
	}

Thank you!

Im Dead Good Morning GIF