Dashboard with Two BAQs but Single Field for Entry

We’ve got a simple dashboard with two BAQs. Each BAQ has a field to enter the part number. Is there a way we can have a single field where they can enter the part number, and both BAQs will connect to it? We’re using 10.2.700.

Here’s a screenshot of what we’re working with:

1 Like

Yes you can Publish the Part# in the top BAQ and Subscribe it in the second.

Here are examples from a dashboard we have.
Publish:

Subscribe:
image

5 Likes

Hey Randy, thanks so much for your quick response! This really helped me out. Now, I’m trying to make things even better. Is it possible to have the dashboard refresh when a new part number is entered? Like, when they hit the Enter key or when they leave the part number field?

1 Like

I’ve never done it, but I’d imagine you could do custom code to force a refresh when the field looses focus. There is no checkbox or anything else “easy” to make it happen.

1 Like

Yes, this should get you started.
Customize the dashboard assembly after you deploy it.
Remember to fill in the guid for the textbox you want to use.

This example will do Tab or Enter.

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 **

	EpiTextBox txtPartNum;

	public void InitializeCustomCode()
	{
		// ** 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

		txtPartNum = (EpiTextBox)csm.GetNativeControlReference("guidOfYourTextBox");
		txtPartNum.KeyDown  += new System.Windows.Forms.KeyEventHandler(txtPartNum_KeyDown);
		txtPartNum.KeyPress += new System.Windows.Forms.KeyPressEventHandler(txtPartNum_KeyPress);
	}

	public void DestroyCustomCode()
	{
		// ** 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

		txtPartNum.KeyDown  -= new System.Windows.Forms.KeyEventHandler(txtPartNum_KeyDown);
		txtPartNum.KeyPress -= new System.Windows.Forms.KeyPressEventHandler(txtPartNum_KeyPress);
	}

	private void txtPartNum_KeyDown(object sender, System.Windows.Forms.KeyEventArgs args)
	{
		if(args.KeyCode == Keys.Tab) Refresh();
	}

	private void txtPartNum_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs args)
	{
		if(args.KeyChar == (char)Keys.Enter) Refresh();
	}

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

To add on, can probably also do this from the

this.txtPartNum.Leave

rather than checking for a key press so that it only fires when you leave the control rather than hitting tab randomly while on the screen (such as entering data inside another grid and tabbing through, if one was updateable)

Edit -
Oh it’s specifically on the control, nevermind that will work haha. Thought it was on the screen. But, would work on the .Leave if you clicked out of it rather than tabbed.

2 Likes

Yeah it was specifically on the control.

I don’t usually use leave, because I sometimes have multiple criteria to check at once. But if leave floats your boat, have at it, works a treat!

It Works Adam Sandler GIF by Saturday Night Live

1 Like

I don’t know if I’ve ever put a keypress directly on a control like that haha, genius

1 Like

And since OP is a little slow, let’s give Randy the internet points he deserves.
:white_check_mark:

2 Likes

I am, but I don’t think this qualifies lol :rofl:

Strictly platonic…

I Love You GIF by Sesame Street

1 Like