GetNewReportQty after RQForm Load

I am working on a dashboard. The dashboard displays an active labor transaction. From that dashboard am am adding a button “btnRptQty” where when clicked it takes the values on the dashboard and passes them as LaunchFormOptions to the RQForm_Load. It should call the GetNewReportQty method and pass these values as the parameters.

I am not able to get it working. Getting this error, before the RQForm_Load triggers)
Index 0 is either negative or above rows count.

I see that the GetNewReportQty is being called after the RQForm_Load. My problem is I don’t know how to pass these custom parameters to GetNewReportQty… yet I get an error even before the form loads…

This is the code I have on the dashboard for the Report Quantity button:

private void btnRptQty_Click(object sender, System.EventArgs args)
{
    LaunchFormOptions lfo = new LaunchFormOptions();
    
    NameValueCollection collection = new NameValueCollection();
    collection.Add("empID", strEmpID);
    collection.Add("DtlLaborHedSeq", strDtlLaborHedSeq);
    collection.Add("DtlLaborDtlSeq", strDtlLaborDtlSeq);
    string valuein = "GetNewReportQty";

    lfo.IsModal = true;
    lfo.SuppressFormSearch = true;
    lfo.ValueIn = valuein;
    lfo.ContextValue = collection;        
            
    ProcessCaller.LaunchForm(oTrans, "RptQty", lfo);        

}

This is the code on the RQForm_Load:

private void RQForm_Load(object sender, EventArgs args)
{
    MessageBox.Show("load");
	LaunchFormOptions opts = RQForm.LaunchFormOptions;
    if(opts != null && opts.ContextValue != null && opts.ValueIn != null)
    {
        MessageBox.Show(opts.ValueIn.ToString());
        object inObj = RQForm.LaunchFormOptions.ContextValue;
        NameValueCollection collection = new NameValueCollection();
        collection = (NameValueCollection)inObj;

        empID = collection["empID"];
        DtlLaborHedSeq = Convert.ToInt32(collection["DtlLaborHedSeq"]);
        DtlLaborDtlSeq = Convert.ToInt32(collection["DtlLaborDtlSeq"]);

        //MessageBox.Show(empID + " - " + DtlLaborHedSeq.ToString() + " - " + DtlLaborDtlSeq.ToString());

  

    }
}

What needs to change here to pass these custom parameters to GetNewReportQty so RQForm opens with a new record with current empID, DtlLaborHedSeq and DtlLaborDtlSeq?

Any luck on ever figuring this out? I’ve done a bit of searching and found this question asked a few times over the years, but I don’t see any answers. Currently trying to see if there’s a launch form option that’s passing something, but so far I haven’t found one.

In case anyone else needs to do something along these lines in the future, here’s what I found. The ValueIn is being used to pass parameters to the Report Quantity form on open and without filling that in, the form does not open properly. When I checked the ValueIn I found:

RQForm.LaunchFormOptions.ValueIn = System.Collections.Specialized.StringDictionary

So the next step was to find out what the dictionary entries were because I needed to see how they were formatted to be able to duplicate what Epicor is doing.

	if (RQForm.LaunchFormOptions.ValueIn != null) {
		StringDictionary lfoValueIn = (StringDictionary)RQForm.LaunchFormOptions.ValueIn;
		foreach (DictionaryEntry de in lfoValueIn) {
			EpiMessageBox.Show(string.Format("ValueIn Entry: {0} = {1}", de.Key, de.Value));}
	}

Now we can see that there are 3 entries in the dictionary that we need to pass in order for the form to load properly:

laborhead = -1
labordet = -1
jobover = true

As an alternative, I’ve found it easier to just set some environment vars, then clear them after I used them.