UI Customization; Dashboard Sheet

We have a dashboard called My Hours that we’ve added to MES as a sheet and it subscripts to EmpBasic.EmpID. This works perfectly for shop employees to check their times for the last two weeks. I’ve had similar requests for hourly office employees. So I thought I’ll just do the same thing in Office MES.

However, I ran into a few issues. The first being that EmpID or EmployeeNum column is not available in any of the Data Views by default in Office MES. So tried using Data Tools Custom Column Like to add LaborHed.EmployeeNum.

By doing this. EmployeeNum now shows up as a column to subscribe the dashboard sheet too.

However, when I launch Office MES, with the dashboard, it does not subscribe to that column, and I get this error message.

Warning- Embedded Dashboard invoked as a Subscriber, but there is no Filter defined for the Published columns. Please notify the system administrator.

I’ve compared it to the MES customization, and I believe they are setup the same.

Any ideas how I can get this to sync with the current EmpID?

Does your BAQ use any parameters? That seems like it would be the quickest way to do it.

If not, If I were in your boat, and had exhausted all my good efforts (and you already use a tracker view to filter) - my last ditch attempt would be to add filter for EmployeeID - hide the control on the tracker view and populate it via code on form open.

string emp = ((Ice.Core.Session)(oTrans.Session)).EmployeeID;

Good luck

Is your Dashboard just a simple Grid with some hours on it? If so you can use a BAQDataView instead… may work better.

@Chris_Conn, the dashboard has the following filter on it.

@josecgomez, yes, it’s basically a grid, with a GroupBy.

Guess, I’ll look into the BAQDataView. And pointers for a newbie to BAQDataViews?

getnativecontrol reference of the grid and apply the grid filter (or) apply rowfilter on the dashboard dataview .

http://www.csharp-examples.net/dataview-rowfilter/

Alrighty, I’m just now getting back to this. Ever wish you could just focus on one issue at a time?

Anyhow, I’ve managed to add code to create a BAQView from my BAQ and bind it to the EpiUltraGrid. Thanks to @josecgomez for the YouTube video!

My issue is the grid does not populate with any data. The grid shows columns from the BAQ, but no data.

I assumed if I I commented out all but the 1st two lines of the CreateHoursBAQView function (where is sets the view) I would get all the data that shows when testing the BAQ, but that still shows no data…

My code is below, I get all 3 MessageBoxes on load.

[details=THE CODE]```cs
// **************************************************
// Custom code for MesActivityForm
// Created: 5/11/2017 8:37:46 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.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 Ice.Lib.Broadcast;

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 **
BAQDataView baqViewHours;


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
	CreateHoursBAQView();
}

public void CreateHoursBAQView()
{
	baqViewHours = new BAQDataView("HLI-EmpHours");
	oTrans.Add("MyHoursBAQ",baqViewHours);

	string emp = ((Ice.Core.Session)(oTrans.Session)).EmployeeID;
	string pubBinding = "LaborHed.EmployeeNum";
	IPublisher pub = oTrans.GetPublisher(pubBinding);
	MessageBox.Show( "Session EmpID: " + emp );
	if(pub==null)
{
	MessageBox.Show( "pub = null" );
	oTrans.PublishColumnChange(pubBinding, "MyCustomPublish");
	pub = oTrans.GetPublisher(pubBinding);
}

if(pub !=null)
	MessageBox.Show( "pub != null" );
	baqViewHours.SubscribeToPublisher(pub.PublishName, "EmpBasic_EmpID");
}

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
}

}

Is there data in the LaborHed DataView? The screen shot you have posted it doesn’t look like it.

Sorry, I think that screenshot was taken while customization was open.

The EmpID field in top right-hand corner is bound to LaborHed.EmployeeNum and it’s populated, but the BAQ is empty.

Norman,

I ran across several places where the EmployeeID was not being populated by the system. I took matters in to my own hands to solve it. Here is what I did in my part tran bpm to fix it. You could do a null check first to make sure it’s needed. I also did something similar in a Receiving BPM.

  ttPartTran.FirstOrDefault().EmpID = Session.EmployeeID;  // aglitch in E10 cause it not to log the EMP

Thanks for the idea @Chris_Conn. Here’s what I tried, I added the following code to the CreateHoursBAQView.

	EpiDataView eData = (EpiDataView)oTrans.EpiDataViews["LaborHed"];
	DataRow edRow = eData.CurrentDataRow;
	string empID = (string)edRow["EmployeeNum"];
	MessageBox.Show( "DataView EmpID: " + empID );

The messagebox shows up with the current EmpID, so I don’t think thats the issue.

I don’t think it’s an issue with the Publish & Subscript, if I just attached the BAQ to the grid without subscribing it to anything, shouldn’t I get all the data I get when I test the BAQ? I do not; I get no data…

let me see your code

So when you run BAQ in designer you can see the EmployeeID?

Yes, both LaborHed_EmployeeNum and EmpBasic_EmpID, not that both are
needed. It’s showing all LaborHed records for the last 2 weeks and I want
to filter it by the Logged in EmpID.

Thanks,

Norman Hutchins
System Administrator
Howell Laboratories, Inc.

Can you paste the code you are using to load the BAQDataView

But of course I can.

	public void CreateHoursBAQView()
	{
		baqViewHours = new BAQDataView("HLI-EmpHours");
		oTrans.Add("MyHoursBAQ",baqViewHours);

//DataView Check
EpiDataView eData = (EpiDataView)oTrans.EpiDataViews["LaborHed"];
DataRow edRow = eData.CurrentDataRow;
string empID = (string)edRow["EmployeeNum"];
MessageBox.Show( "DataView EmpID: " + empID );

//Core Session Check
string emp = ((Ice.Core.Session)(oTrans.Session)).EmployeeID;
MessageBox.Show( "Session EmpID: " + emp );

		string pubBinding = "LaborHed.EmployeeNum";
		IPublisher pub = oTrans.GetPublisher(pubBinding);

		if(pub==null)
	{
MessageBox.Show( "pub = null" );
		oTrans.PublishColumnChange(pubBinding, "MyCustomPublish");
		pub = oTrans.GetPublisher(pubBinding);
	}

	if(pub !=null)
MessageBox.Show( "pub != null" );
		baqViewHours.SubscribeToPublisher(pub.PublishName, "EmpBasic_EmpID");
	}

So if you just have this

baqViewHours = new BAQDataView("HLI-EmpHours");
oTrans.Add("MyHoursBAQ",baqViewHours);

And nothing else, do you get data on the grid? Also when is this running ? which method are you calling this from?

Correct if I comment out all but those 2 lines, no data shows up on the grid.

CreateHoursBAQView(); is being called from InitializeCustomCode().

And I am assuming that HLI-EmpHours doesn’t have any parameters or anything like that right?

Correct as well. Just a straight query, 2 tables, and one criteria.

No other ideas why I wouldn’t be getting data on the grid when I don’t pub&sub to anything? @josecgomez or @Chris_Conn