Dashboard Refresh All Issue

Good morning,
I have a bit of code that I’ve used in the past to make a dashboard with two updatable queries, and a third blank panel to hold some text labels and a button.

In my past dashboard the two grid queries were set to refresh on load, and the dashboard was set to automatically refresh on load. In addition, I have a custom function called RefreshAll that will manually call the refresh all tool to update all the queries.

This all works great in my first dashboard. But now that I am doing it in a second dashboard, only one of my two queries will update automatically. If I click the grid that does not update, I can click refresh and get the data, but refresh all, makes that grid go blank. Very strange behavior!

Here is my customized form code that works great in my other dash. I have checked all the usings, settings, and properties for these form elements and they all match.

// **************************************************
// Custom code for MainController
// Created: 10/3/2019 10:50:55 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;
using System.Reflection;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	private EpiDataView edvV_OpenOrderRequests_Fast_1View;
	private EpiDataView edvV_OurUnmatchedOrders_faster_1View;
	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **


	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		this.edvV_OpenOrderRequests_Fast_1View = ((EpiDataView)(this.oTrans.EpiDataViews["V_OpenOrderRequests_Fast_1View"]));

		this.edvV_OpenOrderRequests_Fast_1View.EpiViewNotification += new EpiViewNotification(this.edvV_OpenOrderRequests_Fast_1View_EpiViewNotification);
		this.edvV_OurUnmatchedOrders_faster_1View = ((EpiDataView)(this.oTrans.EpiDataViews["V_OurUnmatchedOrders_faster_1View"]));
		this.edvV_OurUnmatchedOrders_faster_1View.EpiViewNotification += new EpiViewNotification(this.edvV_OurUnmatchedOrders_faster_1View_EpiViewNotification);
		// End Wizard Added Variable Initialization
		
		// Begin Wizard Added Custom Method Calls

		this.epiButtonC1.Click += new System.EventHandler(this.epiButtonC1_Click);
		CreateRowRuleV_OpenOrderRequests_Fast_1ViewCalculated_toggleEquals_1();;

		// End Wizard Added Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		this.epiButtonC1.Click -= new System.EventHandler(this.epiButtonC1_Click);
	
		this.edvV_OpenOrderRequests_Fast_1View.EpiViewNotification -= new EpiViewNotification(this.edvV_OpenOrderRequests_Fast_1View_EpiViewNotification);
		this.edvV_OpenOrderRequests_Fast_1View = null;
		this.edvV_OurUnmatchedOrders_faster_1View.EpiViewNotification -= new EpiViewNotification(this.edvV_OurUnmatchedOrders_faster_1View_EpiViewNotification);
		this.edvV_OurUnmatchedOrders_faster_1View = null;
		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

	private void epiButtonC1_Click(object sender, System.EventArgs args)
	{
		//Call Actions
		oTrans.PushStatusText("Running Custom Actions...", false);
		//check to see if there are any boxes checked in OurUnmatched, if so, then execute custom action
		oTrans.PushStatusText("Processing commands for our unmatched orders...", false);
		//V_OurUnmatchedOrders_faster_1View
		var edv = oTrans.Factory("V_OurUnmatchedOrders_faster_1View");
		BAQRunCustomAction(edv, "ProcessCommands");
		//check to see if there are any boxes checked in Unmatched, if so, then execute custom action
		oTrans.PushStatusText("Processing commands for  unmatched orders...", false);
		//V_OpenOrderRequests_Fast_1View1
		edv = oTrans.Factory("V_OpenOrderRequests_Fast_1View");
		BAQRunCustomAction(edv, "ProcessCommands");
		
		//Call Dash Refresh All
		RefreshAllBAQs();
	}
	
	private void MainController_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
		epiLabelC3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;		
		epiLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
		epiLabelC2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
		MainController.WindowState = FormWindowState.Maximized;
	}


	private void CreateRowRuleV_OpenOrderRequests_Fast_1ViewCalculated_toggleEquals_1()
	{
		// Description: new2
		// **** begin autogenerated code ****
		RuleAction warningV_OpenOrderRequests_Fast_1View_RowAction = RuleAction.AddRowSettings(this.oTrans, "V_OpenOrderRequests_Fast_1View", true, SettingStyle.Warning);
		RuleAction[] ruleActions = new RuleAction[] {
				warningV_OpenOrderRequests_Fast_1View_RowAction};
		// Create RowRule and add to the EpiDataView.
		RowRule rrCreateRowRuleV_OpenOrderRequests_Fast_1ViewCalculated_toggleEquals_1 = new RowRule("V_OpenOrderRequests_Fast_1View.Calculated_toggle", RuleCondition.Equals, 1, ruleActions);
		((EpiDataView)(this.oTrans.EpiDataViews["V_OpenOrderRequests_Fast_1View"])).AddRowRule(rrCreateRowRuleV_OpenOrderRequests_Fast_1ViewCalculated_toggleEquals_1);
		// **** end autogenerated code ****
	}

	private void edvV_OpenOrderRequests_Fast_1View_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{
			String myRef ="724d4f74-671e-4121-a733-bc073bdb144d";
			EpiUltraGrid mesGrid;		
			mesGrid = (EpiUltraGrid)csm.GetNativeControlReference(myRef);
			mesGrid.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
			mesGrid.DisplayLayout.Appearance.FontData.SizeInPoints = 10;
			mesGrid.Parent.Width = 625;
			mesGrid.Width = 625;		
			mesGrid.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;	
			mesGrid.DisplayLayout.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand, true);
			mesGrid.Text = mesGrid.Rows.Count + " -  Open Requests to be Created or Current Release Updated";

			if (mesGrid.Rows.Count >=1)
			{
				BoldTopLine(myRef);
			}
	}

	private void edvV_OurUnmatchedOrders_faster_1View_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{
			String myRef ="64a4559a-a942-4836-98d0-eb53fb6fc5c0";
			EpiUltraGrid mesGrid;		
			mesGrid = (EpiUltraGrid)csm.GetNativeControlReference(myRef);
			mesGrid.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;			
			mesGrid.DisplayLayout.Appearance.FontData.SizeInPoints = 10;
			mesGrid.Parent.Width = 785;
			mesGrid.Width = 785;
			mesGrid.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
			mesGrid.DisplayLayout.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand, true);
			mesGrid.Text = mesGrid.Rows.Count +  " - Our Open Releases to be Closed or Updated";
						if (mesGrid.Rows.Count >=1)
			{
				BoldTopLine(myRef);
			}
	}

	void RefreshAllBAQs()
	{
		oTrans.PushStatusText("Refreshing all views. Please be patient...", false);      
		MainController.AppControlPanel.HandleToolClick("RefreshAllTool", new 
		Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshAllTool"], null)); 
		oTrans.PushStatusText("Done!", false);
		
	}
	
	 void BAQRunCustomAction(EpiDataView iEdv, string iActionID)
	{
	    BAQDataView BAQView = (BAQDataView)iEdv;
	    Assembly assembly = Assembly.LoadFrom("Ice.Lib.EpiClientLib.dll");
	    Type t = assembly.GetType("Ice.Lib.Framework.BAQUpdater");
	    MethodInfo mi = t.GetMethod("BAQRunCustomAction", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
		mi.Invoke("Ice.Lib.Framework.BAQUpdater", new object[]{BAQView, iActionID});
	}
	void BoldTopLine(String myRef)
	{
		EpiUltraGrid mesGrid;		
		mesGrid = (EpiUltraGrid)csm.GetNativeControlReference(myRef);
		UltraGridGroupByRow groupByRow = (UltraGridGroupByRow)mesGrid.Rows[0];
		groupByRow.Appearance.FontData.Bold = DefaultableBoolean.True;
		groupByRow.Appearance.FontData.SizeInPoints = 14;
	}

}

Has anyone ever experienced this with the refresh all tool? If so, did you figure out a solution? I need that refresh all tool to work just like it does for my other dashboards. Debugging in VS indicates that there is a problem in the BoldTopLine function. Again, that works great in my other dashboards.

Unable to cast object of type 'Infragistics.Win.UltraWinGrid.UltraGridRow' to type 'Infragistics.Win.UltraWinGrid.UltraGridGroupByRow'.

Thanks for your time!
Nate

This issue seems to be intermittent. Sometimes I get the problem popup, other times the function works normally. I am not sure where to begin debugging this. It seems to be working now, though I am not sure why. The only changes I made were to update my uses of “String” to “string”. That’s it really.
If anyone has any ideas I would love to hear them! :slight_smile:

Hi Nate,

I am having problems with getting a dashboard auto refresh working also. I tried your ResetMe code to no avail. It seems like I’m unable to get a handle on the entry of a part number in the dashboard to get the refresh to run. I’ve tried customization of the runtime tracker then tried the db assembly, with neither working.
I’m at my wits end and thought maybe you’d have an idea for me. I tried using part number after change event and before change event. I’m not even getting my message box… so IDK what to do with it.
See below, part number gets entered into field… then I need an auto refresh. If I do refresh button manually from the part number field in this state, it works. I can put a tab or enter after the part number before the ResetMe/Refresh if needed, but that doesn’t seem to do anything to make it go automatic refresh either. I am using a barcode scanned to enter the part number and the lower grid will show all warehouse/all site availability of part.
Thanks for your consideration!
Nancy

I would be happy to take a look. What does your Customization code look like?

I have triggered off of _ValueChanged, and _Leave. You can also refresh with this little bit:

	private void ResetMe()
	{			
MainController.AppControlPanel.HandleToolClick("RefreshTool", new 
Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));
	}

Thanks Nate!
Here is where I left off. I used the wizard to go off of both after field change and before field change. I didn’t expect before field change to work but thought at least I might see if the event was recognized and an attempt made via the code to do the refresh, but it didn’t work. This customization screenshot below was on the PartNum field in the tracker view for the dashboard assembly. Second screenshot shows limited events available in the wizard. Am I able to use something like _Leave even though it’s not in the wizard? Please excuse my lack of programming knowledge in the customizations… they are not my strong point!

Nancy

Yes! Just make sure you setup the initialize custom code and destroy custom code parts. For example, these just setup the event like the wizard would. There are two examples here, _Leave and _ValueChanged:

	public void InitializeCustomCode()
	{
txtMyPart = (EpiTextBox)csm.GetNativeControlReference("5678fb25-ccec-4ff9-ba79-48c2d550a09e");
txtMyRev = (EpiTextBox)csm.GetNativeControlReference("c9fbfa13-28a5-446b-86bb-eb30b7ba80e2");
this.txtMyPart.Leave += new System.EventHandler(this.txtMyPart_Leave);
this.txtMyRev.ValueChanged += new System.EventHandler(this.txtMyRev_ValueChanged);
	}


	public void DestroyCustomCode()
	{
this.txtMyPart.Leave -= new System.EventHandler(this.txtMyPart_Leave);
this.txtMyRev.ValueChanged -= new System.EventHandler(this.txtMyRev_ValueChanged);
	}

I should also note that the part number and rev fields I am using here are native fields, added to the dashboard tracker view and prompts before I started any customization.

I never had much luck with the before/after field change events.

If you use the _leave event, make sure to put some check in there to ensure you have a value before you try to refresh. Like this:

private void txtMyPart_Leave(object sender, System.EventArgs args)
	{
		if (txtMyPart.Text!="")  
		{
			// Do refresh or other work...
		}
	}
1 Like

Thanks SO much Nate! I’ll give it a whirl and post back.

Nancy

Hi Nate,

I got it working! Thanks so much for your help. I really appreciate it. For any future readers, I did have one little gotcha, declaring the variable for the text box at the start per below screenshot.

Nancy

1 Like