Getting and Setting Selected Record in Dashboard BAQ EpiUltraGrid

Hi all,
I am struggling with some syntax for accessing the EpiUltraGrids that are automatically added to my dashboards when I add a BAQ. The system names the grids all ‘myGrid’. I want to be able to do things like check what record is selected on a grid, select a different record, and change the record that is initially selected on load.

I believe I need to reference my EpiUltraGrids EpiBinding value. I just can’t seem to find the right syntax to put it all together. Here is some pseudocode I have been toying with:

// ---- WARNING PSEUDOCODE ONLY! ----
//Select and set active row to first row.
EpiUltraGrid MyLeftGrid = EpiBinding(V_Cust_OurUnmatchedOrders_faster_1View);
EpiUltraGrid MyRightGrid = EpiBinding(V_Cust_OpenOrderRequests_Fast_1View1);
MyLeftGrid.SelectedRow = 0; // or first row
MyLeftGrid.SelectedRow.Activate;
MyRightGrid.SelectedRow = 0; // or first row
MyRightGrid.SelectedRow.Activate;

// Find a row in MyLeftGrid with a PartNum in a column, then select and activate it
For each row in MyLeftGrid
{
   if (MyLeftGrid.Column("PartNum") == FindPart)
      {
         MyLeftGrid.SelectedRow = row;
         MyLeftGrid.SelectedRow.Activate;
      }
}

If you know the right way to accomplish this, I would greatly appreciate any advice you have to offer.

Thanks for your time!
Nate

You should be able to find the EpiGuid in the customization tools dialog for that dashboards EpiUltraGrid, and reference it with that.

I added a button to MES that pulls up the Job Traveler for the job selected on the MES grid. Here’s some of the setup code:

EDIT. usings (should be the only ones needed?):
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win;

// Add Custom Module Level Variables Here **
EpiUltraGrid mesGrid;

// Begin Wizard Added Variable Initialization
mesGrid = (EpiUltraGrid)csm.GetNativeControlReference("a9cf2b4f-03f2-499e-9744-c311af7f8172");

//stuff in the click function
// Get Active Row
UltraGridRow ultraGridRow = mesGrid.ActiveRow;
//Get a row's cell value for particular column
jobNum = ultraGridRow.GetCellValue("JobNum").ToString();

Hopefully this helps.

1 Like

This was helpful. I can now reference the correct grids.

However I am having trouble making each grid have the top record selected and activated. Using the code below the form opens, then sets the selected/active row to the top row, then clears any expanded groups.

private void edvV_Cust_OurUnmatchedOrders_faster_1View_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{	
if ((args.NotifyType == EpiTransaction.NotifyType.Initialize) && view.dataView.Count > 0)
		{
		SelectTopRow("64a4559a-a942-4836-98d0-eb53fb6fc5c0");
		}
	}

private void edvV_Cust_OpenOrderRequests_Fast_1View1_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{				
if ((args.NotifyType == EpiTransaction.NotifyType.Initialize) && view.dataView.Count > 0)
		{
		SelectTopRow("724d4f74-671e-4121-a733-bc073bdb144d");
		}
}

void SelectTopRow(String NCref)
{
//MessageBox.Show("Selecting Top");
EpiUltraGrid theGrid;
theGrid = (EpiUltraGrid)csm.GetNativeControlReference(NCref);
theGrid.Rows.CollapseAll(true);
theGrid.Selected.Rows.Clear();
theGrid.Rows[0].Activate();
theGrid.Rows[0].Selected=true;
theGrid.DisplayLayout.RowScrollRegions[0].FirstRow = theGrid.DisplayLayout.Rows[0];
}

The code compiles and works, but after everything in my code is done, my grid still selects a part number half way down the list and expands the group. I think I am doing things in the wrong order. Should I be looking at a different event? I would like the form to open to the top row, and after every refresh, go back to the top row and expand the first row.

Thanks again!
Nate

I figured out that I had to sort my BAQ to have the correct first record show up first. The display sort in my dashboard was set differently than my BAQ sort, so things didn’t line up quite right. Seems to be ok now.
Thanks!!

1 Like

How can I find the EpiGuid of query grid?

Go into customization mode, then you can find the grid in the list of the tree view, and find the GUID on the properties tab. You can also click a grid then go to the properties tab (while in customization mode)

Yes, but developing a Dashboard I can only customize the Tracker, but I can’t customize the Summary that contains the grid
imatge

If you haven’t already, will need to deploy the dashboard as assembly, create a menu item for it, then launch the actual dashboard in customization mode.

2 Likes