youâll need a few things. First yes, you can access that grid as a dataview and get the values you need. Second you will use something called launch form options (LFO), third, youâll need a UI customization on your BAQ report to use and assign those values passed thru in the LFO context. There are a multitude of examples on this sight in how to declare and access a dataview. I suggest the search function to help yourself there. below is an example of how you could pass values using an LFO. This could be an object such as a datarow, a list, a dictionary etcâŚ
here is an example of how to use LFO
private void btnPrintAll_Click(object sender, System.EventArgs args)
{
String jobList = "";
List<UltraGridRow> rr = myGrid.Rows.GetAllNonGroupByRows().ToList();
LaunchFormOptions lfo = new LaunchFormOptions();
// In your case you may want to use the selected rows property instead
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in myGrid.Rows)
{
if ((bool)row.Cells["Print"].Value == true)
// We are passing a list of jobs for the BAQ report filter
jobList += string.Format("'{0}',", row.Cells["OrderHed_OrderNum"].Value);
}
lfo.ContextValue = jobList.Substring(0, jobList.Length - 1);
lfo.IsModal = true;
// this launches the menu item, in this case a BAQ report
ProcessCaller.LaunchForm(oTrans, "TRAVBPR", lfo);
}
in your BAQ report customization the pass context values are used as shown. Keep in mind that different BAQ reports reference parameters in slightly different ways.
declare a public class variable
EpiDataView edvReportParam;
instantiate the object in initialize customcode
edvReportParam = oTrans.Factory(âReportParamâ);
private void BAQReportForm_Load(object sender, EventArgs args)
{
// Add Event Handler Code
if(BAQReportForm.LaunchFormOptions!=null && BAQReportForm.LaunchFormOptions.ContextValue !=null)
{
DataSet ds = (DataSet)((Dictionary<string,DataSet>)oTrans.GetType().GetField("filterDataSets", BindingFlags.Public
| BindingFlags.Instance
| BindingFlags.NonPublic).GetValue(oTrans))["FilterList2"];
EpiDataView edv = oTrans.Factory("FilterList2");
// Filterlist 2, because it's the second of two filters defined in the BAQ report
ds.Clear();
bool recordSelected=false;
string[] orders = BAQReportForm.LaunchFormOptions.ContextValue.ToString().Split(',');
int split = (orders.Length / 30);
if(orders.Length % 30 > 0)
split++;
int index=0;
OrderHedListDataSet holdingDS = new OrderHedListDataSet();
for(int i =0; i<split;i++)
{
string ordersS ="";
for(int c=0; c<30;c++)
{
if(orders.Length >index)
{
ordersS+= orders[index]+",";
index+=1;
}
else
break;
}
string whereClause = string.Format("OrderNum in ({0})",ordersS.Substring(0,ordersS.Length-1));
DataSet dataSet = SearchFunctions.listLookup(oTrans, "SalesOrderAdapter", out recordSelected, false, whereClause, true);
holdingDS.Merge(dataSet,true,MissingSchemaAction.Ignore);
}
ds.Merge(holdingDS, true, MissingSchemaAction.Ignore);
edv.Notify(new EpiNotifyArgs(oTrans, edv.dataView.Count-1, EpiTransaction.NotifyType.Initialize));
//oTrans.GetType().GetMethod("refreshFilterSummary", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(oTrans, null);
oTrans.RefreshFilterSummary();
}
edvReportParam.dataView[edvReportParam.Row]["ArchiveCode"] = 1;
}
as you can tell itâs not a trivial endeavor but it can be done. This should give you a start though.