The parameter 'QuoteNum' has no value specified and empty value is not allowed

Hello,

I am currently designing a new report to implement into Epicor, which is triggered from the Quote screen. I’ve successfully built the BAQ report, and added a Print Button (since the screen does not have a print icon in the top right corner, and the other print options are not BAQ report-based).

Problem:

  • Quote number is successfully passed from the Quote screen to the Print Screen when I enter the quote number.
  • However, when I click on Print, the quote number is not recognized in the BAQ report, even though it’s visibly present in the Field on the print screen.

What I’ve Done:

  1. I’ve implemented a button to trigger the print action and pass the quote number using LaunchFormOptions.
  2. I’m using a custom BAQ report form that uses the passed quote number for generating the report.

The Issue:

Despite the quote number being correctly passed to the print form and visible on the screen, the BAQ report does not recognize the value when printed. I get an error message stating “The parameter ‘QuoteNum’ has no value specified and empty value is not allowed.”

Here is the code for the quote screen

// **************************************************
// Custom code for QuoteForm
// Created: 02/10/2024 09:07:55
// **************************************************

extern alias Erp_Contracts_BO_QuoteDtlSearch;
extern alias Erp_Contracts_BO_Quote;
extern alias Erp_Contracts_BO_Customer;
extern alias Erp_Contracts_BO_AlternatePart;
extern alias Erp_Contracts_BO_Part;
extern alias Erp_Contracts_BO_Vendor;
extern alias Erp_Contracts_BO_VendorPPSearch;
extern alias Erp_Contracts_BO_ShipTo;

using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **
	EpiDataView edvQuoteHed;
	EpiDataView edvQuoteDtl;
	EpiDataView edvCustomer;
	EpiDataView edvSalesRep;

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization
		
		edvQuoteHed = (EpiDataView)oTrans.EpiDataViews["QuoteHed"];
		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls
		this.BtnPrint.Click += new System.EventHandler(this.BtnPrint_Click);
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal
		
		this.BtnPrint.Click -= new System.EventHandler(this.BtnPrint_Click);		

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

	// Button click event to open the print form
	private void BtnPrint_Click(object sender, System.EventArgs args)
	{
		// ** Place event handling code here **
		if (edvQuoteHed != null && edvQuoteHed.CurrentDataRow != null)
		{
			oTrans.Update();
			string quoteNum = edvQuoteHed.CurrentDataRow["QuoteNum"].ToString();
			
			if (!string.IsNullOrEmpty(quoteNum))
			{
				LaunchFormOptions lfo = new LaunchFormOptions();
				lfo.ContextValue = quoteNum;

				MessageBox.Show("Launching form with QuoteNum: " + quoteNum);

				ProcessCaller.LaunchForm(oTrans, "Printa", lfo);
			}
			else
			{
				MessageBox.Show("QuoteNum is empty or null.");
			}
		}
		else
		{
			MessageBox.Show("No Quote is selected");
		}
	}

}

Here is the code for the print screen

// **************************************************
// Custom code for BAQReportForm
// Created: 02/10/2024 11:09:44
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **
	
	private EpiDataView edvReportParam;
	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

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

		this.edvReportParam = ((EpiDataView)(this.oTrans.EpiDataViews["ReportParam"]));
		this.edvReportParam.EpiViewNotification += new EpiViewNotification(this.edvReportParam_EpiViewNotification);
		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		this.edvReportParam.EpiViewNotification -= new EpiViewNotification(this.edvReportParam_EpiViewNotification);
		this.edvReportParam = null;

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

	private void BAQReportForm_Load(object sender, EventArgs args)
	{
	    if (BAQReportForm.LaunchFormOptions != null)
	    {
	
			MessageBox.Show("ContextValue: " + BAQReportForm.LaunchFormOptions.ContextValue.ToString());

	        if (edvReportParam.Row > -1) // Ensure a valid row exists
	        {
	            if (edvReportParam.dataView.Table.Columns.Contains("Field1")) // Ensure the field exists
	            {
	                edvReportParam.dataView[edvReportParam.Row]["Field1"] = BAQReportForm.LaunchFormOptions.ContextValue.ToString();
	            }
	            else
	            {
	                // Handle the case where the field doesn't exist
	                MessageBox.Show("Field 'field1' does not exist in ReportParam dataset.");
	            }
	        }
	        else
	        {
	            // Handle the case where there’s no valid row
	            MessageBox.Show("No valid row in ReportParam.");
	        }
	    }
	}

	private void edvReportParam_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{
	
	if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
	{
		if ((args.Row > -1))
		{
		}
	}
	}
}

here is the BAQ

image

I have added a parameter for QuoteNum and in the QuoteHed table.

Questions:

  • Why does the BAQ not recognize the quote number even though it’s visibly passed and assigned to the field?
  • Is there something missing in how I am assigning the context value in the BAQ report?

Any help or suggestions would be appreciated!

1 Like

Hi Taheem,

Can you show what the ‘Option Fields’ looks like for the BAQ Report in BAQ Report Designer please?

Thanks,

Nathan

Sure!

Great, can you try removing the parameter from the BAQ as well as the criteria that relies on it? You’ll need to leave the option field as it is.

Thanks,

Nathan

1 Like

omds thank you, My report style still had C:/ on it :man_facepalming:t4:. It works without the parameter and just tried with the parameter but it gave that error.

1 Like