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.
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.
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
}
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
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…
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.