Hello everyone,
########################## BACKGROUND INFORMATION ##########################
I have a dashboard which was built to mirror the existing “Production Planner Workbench” dashboard. The only difference is I have replaced the standard BAQs which drive the Production Planner Workbench with updateable BAQs which allow users to release and firm jobs from this dashboard. There is also a simple customization on this dashboard which allows users to mark all visible jobs on the screen as released via a button click event (code attached below). This is all working without issue - I’m including for context.
Customization code:
// **************************************************
// Custom code for MainController
// Created: 1/15/2020 10:13:17 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Collections.Generic;
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;
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 **
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.Results_Column.ColumnChanging += new DataColumnChangeEventHandler(this.Results_BeforeFieldChange);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Call
this.epiButtonReleaseAll.Click += new System.EventHandler(this.epiButtonReleaseAll_Click);
this.epiButtonReleaseFull.Click += new System.EventHandler(this.epiButtonReleaseFull_Click);
this.epiButtonReleaseShortage.Click += new System.EventHandler(this.epiButtonReleaseShortage_Click);
// End Wizard Added Custom Method Calls
//this.baseToolbarsManager.Tools["SaveTool"].ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.SaveButton_Click);
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.epiButtonReleaseAll.Click -= new System.EventHandler(this.epiButtonReleaseAll_Click);
this.epiButtonReleaseFull.Click -= new System.EventHandler(this.epiButtonReleaseFull_Click);
this.epiButtonReleaseShortage.Click -= new System.EventHandler(this.epiButtonReleaseShortage_Click);
this.Results_Column.ColumnChanging -= new DataColumnChangeEventHandler(this.Results_BeforeFieldChange);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
//this.baseToolbarsManager.Tools["SaveTool"].ToolClick -= new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.SaveButton_Click);
}
private void epiButtonReleaseAll_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if (MessageBox.Show("Are you sure you want to release ALL JOBS?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
EpiDataView dv = (EpiDataView)(oTrans.EpiDataViews["V_UD_uProductionPlannerJobs_2_1View3"]);
DataView datView = dv.dataView;
foreach(DataRowView rowView in datView)
{
rowView.Row["JobHead_JobReleased"] = true;
//rowView.Row["JobHead_JobFirm"] = true;
}
}
}
private void epiButtonReleaseFull_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if (MessageBox.Show("Are you sure you want to release all visible jobs with FULL AVAILABILITY?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
EpiDataView dv = (EpiDataView)(oTrans.EpiDataViews["V_UD_uProductionPlannerJobs_2_1View1"]); // V_UD_uProductionPlannerJobs_2_1View3 = ALL JOBS
DataView datView = dv.dataView;
foreach(DataRowView rowView in datView)
{
rowView.Row["JobHead_JobReleased"] = true;
//rowView.Row["JobHead_JobFirm"] = true;
}
}
}
private void epiButtonReleaseShortage_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if (MessageBox.Show("Are you sure you want to release all SHORTAGE JOBS?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
EpiDataView dv = (EpiDataView)(oTrans.EpiDataViews["V_UD_uProductionPlannerJobs_2_1View2"]); // V_UD_uProductionPlannerJobs_2_1View1 = Full only
DataView datView = dv.dataView;
foreach(DataRowView rowView in datView)
{
rowView.Row["JobHead_JobReleased"] = true;
//rowView.Row["JobHead_JobFirm"] = true;
}
}
}
private void Results_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "JobHead_JobReleased":
if ((bool)args.ProposedValue == true)
{
args.Row["JobHead_JobFirm"] = true;
}
break;
}
}
Our users recently added a new request for this dashboard to include a 12 month running total of how often the specific part on a job has been used. Simple. I updated the BAQs driving this dashboard to look in the PartTran table for each time a ‘STK-CUS’ trantype occurs and for lower level parts, for every time a ‘STK-MTL’ trantype occurs. The new queries are working as expected.
######################## END BACKGROUND INFORMATION ########################
NOW - on to the issue. After these queries were created, I updated the dashboard to use the new queries (I made new queries instead of updating the originals so I could roll back worst case scenario), and everything is displaying as it should. However, whenever I attempt to use any of the button controls to release jobs, I receive the following error:
Error text: “String was not recognized as a valid Boolean. Couldn’t store <> in JobHead_JobFirm Column. Expected type is Boolean”.
Simple error to fix… at least it should be. Debugging in visual studio, the error occurs on the following line in any of the button control click events:
args.Row["JobHead_JobFirm"] = true;
Full event code:
private void Results_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "JobHead_JobReleased":
if ((bool)args.ProposedValue == true)
{
args.Row["JobHead_JobFirm"] = true;
}
break;
}
}
As you can see, I am not attempting to store a string in args.Row[“JobHead_JobFirm”], but I’m not sure if something is happening up stream which would cause this.
Note that since I am using a different BAQ, I had to update button control’s click event code. The EpiDataView’s name I use to create the “dv” object had to be changed to reflect the new EpiDataView. Nothing in the code has been touched other than this
Original click event for the same button:
EpiDataView dv = (EpiDataView)(oTrans.EpiDataViews["V_UD_uProductionPlannerJobs_2_1View1"]);
Code after changing query:
EpiDataView dv = (EpiDataView)(oTrans.EpiDataViews["V_UD_uProductionPlannerJobs_usg_1View1"]);
Nothing else changed.
One final note to complicate things even further - this recently stopped occurring on my local machine as I was debugging in visual studio. I had made no code changes and thought this was odd. I went to another machine to test this and the error still occurs on that second machine. I still receive the error on my own workstation on occasion, but it’s much rarer now.