Question

Launch Customised ReportQuantity fromMES

  • 13 September 2021
  • 2 replies
  • 131 views

  • Anonymous
  • 0 replies

I have a customised ReportQuantity screen in MES, which, when I click on the button gives me an error:

Index 0 is either negative or above rows count.


It then goes on to load the form correctly with the values from the MES screen.

 

I am using ValueIn LaunchFormOption to send the parameters and then RQ_FormLoad oTrans.GetNewReportQty to retrieve.

 

To me it looks as if the data validation is firing before the RQ_FormLoad… Should I be passing these values before this?

 

Thanks

 

Geoff


2 replies

Are you launching the form through MES and can you post the code from the Form_Load event?

Apittman, thanks for your response. Yes I am launching it from the MES screen.

 

The code for firing the Report Quantity from MES is:

private void btnMTLTag_Click(object sender, System.EventArgs args)
    {
        if (btnMTLTag.ReadOnly == false)
        {
            EpiDataView edvLabDtl = (EpiDataView)(oTrans.EpiDataViews["LaborDtl"]);
            String labDtlSeq = edvLabDtl.dataView[edvLabDtl.Row]["LaborDtlSeq"].ToString();
            EpiDataView edvLabHed = (EpiDataView)(oTrans.EpiDataViews["LaborHed"]);
            String labHedSeq = edvLabHed.dataView[edvLabHed.Row]["LaborHedSeq"].ToString();
            EpiDataView edvEmpID = (EpiDataView)(oTrans.EpiDataViews["EmpBasic"]);
            String empID = edvEmpID.dataView[edvEmpID.Row]["EmpID"].ToString();

            LaunchFormOptions launchObject = new LaunchFormOptions
            {
                IsModal = false,
                SuppressFormSearch = true,
                ValueIn = labHedSeq + "," + labDtlSeq
            };
            ProcessCaller.LaunchForm(this.oTrans, "MTLTags", launchObject);
        }
    }

 

And the Report Quantity customisation is:

    private void RQForm_Load(object sender, EventArgs args)
    {
        // Add Event Handler Code
        if(RQForm.LaunchFormOptions != null)
        {
            
            string valueIn = RQForm.LaunchFormOptions.ValueIn.ToString();        
            if (valueIn != null)
            {
                char[] delimeterChar={','};
                string[] valueInArray;
            
                valueInArray = valueIn.Split(delimeterChar);
                oTrans.GetNewReportQty(valueInArray[0],valueInArray[1]);
                
            }
        }
    }

 

What have I done wrong?!

 

Thanks

 

Geoff

Reply