MES - BaqDataView not allowing IPublisher

Hey all,

What would cause IPublisher in MES to be required? I didn’t realise I needed to add a reference? I haven’t on general screens

Here is the code

// **************************************************
// Custom code for MESMenu
// Created: 27/09/2022 14:08:31
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Ice.Lib;
using Ice.BO;
using Ice.Core;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using System.Collections.Generic;
using System.Reflection;
using System.Drawing;
using Infragistics.Win;
using Infragistics.Win.UltraWinStatusBar;
using Infragistics.Win.UltraWinProgressBar;


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 edvLaborDtl;
	BAQDataView myHours;

	// 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.edvLaborDtl = ((EpiDataView)(this.oTrans.EpiDataViews["LaborDtl"]));
		this.edvLaborDtl.EpiViewNotification += new EpiViewNotification(this.edvLaborDtl_EpiViewNotification);
		
		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// 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.edvLaborDtl.EpiViewNotification -= new EpiViewNotification(this.edvLaborDtl_EpiViewNotification);
		this.edvLaborDtl = null;
		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}
	private void WeeklyHours()
	{
	
        myHours = new BAQDataView("TEAGLE-MyHours");
        oTrans.Add("MyHoursBAQDV", myHours);
        string pubBinding = "LaborDtl.EmployeeNum";
        IPublisher pub = oTrans.GetPublisher(pubBinding);
        if (pub == null)
        {
            string pubName = Guid.NewGuid().ToString();
            oTrans.PublishColumnChange(pubBinding, pubName);
            pub = oTrans.GetPublisher(pubBinding);
        }
        if (pub != null)
            myHours.SubscribeToPublisher(pub.PublishName, "LaborDtl_EmployeeNum");

	}


	private void edvLaborDtl_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{
		// ** Argument Properties and Uses **
		// view.dataView[args.Row]["FieldName"]
		// args.Row, args.Column, args.Sender, args.NotifyType
		// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
		if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
		{
			if ((args.Row > -1))
			{
			}
		}
	}

	private void MESMenu_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
		WeeklyHours();
	}
}











Here is the error

Probably

using Ice.Lib.Broadcast;
1 Like

Hi Haso,

How would you get around a row change? e.g employee number changes but the data stays the same… Any ideas?