This was really helpful. I pulled out some code from the private message you sent.
I have created a blank dashboard with an empty tracker view.
Inside this I added a customization with two UltraGrids.
I included your entire “Region Classes”, and implemented them in the following way.
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
private Dictionary<string,DynData> baqs;
private DynData ddxOpenOrders;
private DynData ddmyOpenOrders;
private void InitialiseCode()
{
baqs = new Dictionary<string,DynData>();
ddxOpenOrders = new DynData("x_ThisWeeksUpdate_OpenOrders", oTrans);
ddxOpenOrders.Initialise(
new string[] {}, //BAQ parameter names, or this line null if no parameters
new string[] {}, //BAQ parameter defaults, one for each parameter in the same order, or null if none
new string[] {"Calculated_SortKey"}, //as many field identifiers as needed for a unique row reference
new string[] {"Date", "xQty"}, //full list of the BAQ field CAPTIONS that need to be visible in a grid
new int[] {100,100}, //column width per visible field, one for each in the above string array
new string[] {}, //list of BAQ field captions that need special formating, or null if none
new string[] {}, //matching list of format strings to the above
epiUltraGridC1); //the name of the EpiUltraGrid you want the data to appear in
baqs["x_ThisWeeksUpdate_OpenOrders"] = ddxOpenOrders;
//ddxOpenOrders.GetData();
baqs = new Dictionary<string,DynData>();
ddmyOpenOrders = new DynData("x_ThisWeekUpdate_OurUnmatched", oTrans);
ddmyOpenOrders.Initialise(
new string[] {}, //BAQ parameter names, or this line null if no parameters
new string[] {}, //BAQ parameter defaults, one for each parameter in the same order, or null if none
new string[] {"Calculated_OrderLnRel"}, //as many field identifiers as needed for a unique row reference
new string[] {"OrderLnRel", "OurDate"}, //full list of the BAQ field CAPTIONS that need to be visible in a grid
new int[] {100,100}, //column width per visible field, one for each in the above string array
new string[] {}, //list of BAQ field captions that need special formating, or null if none
new string[] {}, //matching list of format strings to the above
epiUltraGridC2); //the name of the EpiUltraGrid you want the data to appear in
baqs["x_ThisWeekUpdate_OurUnmatched"] = ddmyOpenOrders;
//ddmyOpenOrders.GetData();
}
private void DestroyCode()
{
foreach (DynData dd in baqs.Values)
{
dd.CloseDown();
}
}
private void baseToolbarsManager_ToolClick(object sender, ToolClickEventArgs args)
{
switch (args.Tool.Key)
{
case "SaveTool":
foreach (DynData dd in baqs.Values)
{
dd.Save();
}
break;
case "RefreshTool":
foreach (DynData dd in baqs.Values)
{
dd.GetData();
}
break;
}
}
public void InitializeCustomCode()
{
InitialiseCode();
// ** 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
this.baseToolbarsManager.ToolClick += new ToolClickEventHandler(this.baseToolbarsManager_ToolClick);
}
public void DestroyCustomCode()
{
DestroyCode();
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
this.baseToolbarsManager.ToolClick -= new ToolClickEventHandler(this.baseToolbarsManager_ToolClick);
}
private void MainController_Load(object sender, EventArgs args)
{
// Add Event Handler Code
}
}
I also manually linked the EpiBindings for the two grids to the correct underlying queries. You are right, I could only do this after I had entered the code, saved, and reopened the dashboard. I found that I didn’t need to explicitly list all the fields from each BAQ I wanted in the code. Once the EpiBindings were linked correctly. I just set the displayed fields using the columns property for each UltraGrid.
Now both queries work well. They return all the data I want, and most importantly they do not give an error when switching between grids. But I don’t have my custom actions automatically included in the Actions menu like they are when I created a dashboard with multiple BAQ grids.
I think I am still missing one big step now. How do I utilize my custom actions in each BAQ? The actions rely on the checkboxes to determine how to process the record, so I think the checkboxes are the only things actually being updated by the BAQ Update.
Thank you so much for being so patient and helpful!
Nate