UBAQ Record not being picked up by Update Method

Hello everyone! I hope you’re having a great day. I’ve personally had better, but that’s where I am hoping you can help.

I have an Updateable dashboard that is customized on the dashboard assembly. Long story short, I am pulling up all open order releases and giving myself a calculated checkbox that I look at during the Update method to identify which records I am updating. For some strange reason, if I don’t explicitly unselect the last row I edited, that row is omitted from the update even though it has a checked check box. I’ve seen it completely omit it and I’ve also seen it include the row but not include the last cell update on the row. I can hack my around that until I only have 1 row in the data set :slight_smile:

I am sure it has something to do with the EDV not getting notified or something to that effect… I’ll add my code just in case you want to check it out. Forgive me for not having comments in there yet… basically, I’m creating a new UD100 record and all the UD100A child records associated to it based on this CheckBox being true.

int changeNum = 0;
int countRows = (from ud in Db.UD100
                  select ud).Count();
if (countRows > 0)
{
  changeNum = (int)(from ud in Db.UD100
                  select ud.Number01).Max();
}
                  
changeNum++;
                  
var firstRow = (from q in ttResults
                 where q.OrderRel_Company == callContextClient.CurrentCompany
                 && q.Calculated_ChangeRelease == true
                 select q).FirstOrDefault();
  
if (firstRow != null)
{
  string changeType = firstRow.Calculated_ChangeType;
  string comments = firstRow.Calculated_Comments;
  string changeOrigin = firstRow.Calculated_ChangeOrigin;

  Ice.Contracts.UD100SvcContract boUD100 = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD100SvcContract>(Db);
  Ice.Tablesets.UD100Tableset dsUD100 = new Ice.Tablesets.UD100Tableset();
  
  boUD100.GetaNewUD100(ref dsUD100);
  
  var newUD100 = (from ud in dsUD100.UD100
                  where ud.RowMod == "A"
                  select ud).FirstOrDefault();
  
  if (newUD100 != null)
  {
    newUD100.Key1 = changeNum.ToString();
    newUD100.Number01 = changeNum;
    newUD100.ShortChar01 = changeType;
    newUD100.Character01 = comments;
    newUD100.ShortChar02 = "NEW";
    newUD100.ShortChar03 = callContextClient.CurrentUserId;
    newUD100.ShortChar05 = changeOrigin;
    newUD100.Date01 = DateTime.Today;
    newUD100.CheckBox01 = true;
    
    boUD100.Update(ref dsUD100);
  }
  
  foreach (var eachRow in (from q in ttResults
                           where q.OrderRel_Company == callContextClient.CurrentCompany
                           && q.Calculated_ChangeRelease == true
                           select q))
  {
    
    int orderNum = eachRow.OrderRel_OrderNum;
    int orderLine = eachRow.OrderRel_OrderLine;
    int orderRelNum = eachRow.OrderRel_OrderRelNum;
    DateTime proposedDate = (DateTime)eachRow.Calculated_ProposedDate;
    DateTime originalDate = (DateTime)eachRow.OrderRel_ReqDate;
    string proposedPart = eachRow.Calculated_ProposedPartNum;
        
    boUD100.GetaNewUD100A(ref dsUD100, changeNum.ToString(), "", "", "", "");
    
    var newUD100A = (from ud in dsUD100.UD100A
                    where ud.RowMod == "A"
                    && ud.ChildKey1 == ""
                    select ud).FirstOrDefault();
    
    if (newUD100A != null)
    {
      newUD100A.Key1 = changeNum.ToString();
      newUD100A.ChildKey1 = orderNum.ToString();
      newUD100A.ChildKey2 = orderLine.ToString();
      newUD100A.ChildKey3 = orderRelNum.ToString();
      newUD100A.Number01 = changeNum;
      newUD100A.Number02 = orderNum;
      newUD100A.Number03 = orderLine;
      newUD100A.Number04 = orderRelNum;
      newUD100A.ShortChar01 = changeType;
      newUD100A.Character01 = comments;
      newUD100A.Date01 = proposedDate;
      newUD100A.ShortChar03 = proposedPart;
      newUD100A.CheckBox01 = true;
      newUD100A.ShortChar02 = "NEW";
      newUD100A.Date03 = originalDate;
      
      boUD100.Update(ref dsUD100);
    }
    
  }

}

What did you customize on the dashboard?

Are you absolutely sure the rows aren’t coming in?

1 Like

I can send the dashboard customization as well (it’s a little clumsy because I’ve been trying different things). So what I mean by the rows aren’t coming in, on UD100A, it will be missing the last row I had selected. So it leads me to believe that when the dataset gets to the Method Directive, it does not contain the last row. (I’ve confirmed by Messages that pop up and display the dataset). I see your point. The issue probably isn’t in the BPM but rather the customization.

Forgive me if I missed it, but this Calculated Checkbox you are checking, is it passed down from the BAQ as an updatable field, or is it something you are creating on the fly to check something in the local customization?

@klincecum P.S. you’re always so helpful. I really appreciate it. It’s like you’re always just a bat signal away.

It’s passed in to the grid from the UBAQ as an updateable field.

I’m supposed to be working on Bartender stuff, but I ate a big lunch, and feel sick.

I can’t go home, because my boss looks like death, so I made him go home.

So I’m hanging out here.

Ok cool, I was worried if it was the other way, that the row may not be marked dirty.

Dude I’m with your boss. I am working remotely today because my wife is bedridden with the flu and I suspected I might also be coming down with it… and as the hours tick by, I feel worse and worse. 102 Temp. Body aches. Sucks to suck.

I think I may have stumbled on to something. I am firing the ultraGrid.Update() method in a Before Tool click event on the SaveMenu tool as well as the giant Save button I put in there. It seems to be working now. At least, I can’t replicate my issue. I’m sure the users will poke holes though.

I’ve ran into strange issues before, some were my fault, other times, I rebuilt the dashboard with
the same exact damn code and things work fine.

My neck hurts, arms, feel like I’m somewhere else… yep, have my suspicions.

@klincecum I hope you’re feeling better today.
Whatever I thought I fixed last week, it’s back at its tricks again. In today’s instance, I used my “Select All” button to check all the rows in my grid (6 of them). Then I set my fields using my handy Copy To All Selected button. All rows have data entered in them and ready for me to “Update” the BAQ. I fire the Save button and lo and behold, the first row (the one I happened to be selected on) did not make it into the Update dataset. WTF!? Should I try to “unselect” the row before firing the update? Is it because I’m not actually filling out the row myself and using a button click event to populate the row?

Wait. Are you asking if Kevin was still Home Alone?

Screaming Macaulay Culkin GIF by Home Alone

(It was a gimme and nobody was taking it…)

Incidentally, my wife and I recently stumbled across the house from that movie while in Winnetka, IL to visit a greenhouse that was closing up shop. No joke, it’s just a random house (albeit in a very nice area) in a suburb of Chicago.

Oh, Winnetka is very nice indeed. I grew up between Schaumburg and Elgin. Not nearly as nice… :wink:

1 Like

So the idea of this dashboard is supposed to grab all releases on an order to allow a user to select which ones they want to put in a change request for. You select the first column either by clicking each line or by pressing the Select All button. If you have a mass update, you can put the details in on the left and click Copy To Selected. It fills in all the rows with a check box in them with those details. Or you can manually fill in each line if they are different.

Once you click Submit and Close, it should create records in UD100A for each line selected. I am always missing the first line… See?

Here is the customization that I have on the Order Request dashboard.

using System;
using System.ComponentModel;
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;
using Ice.UI.FormFunctions;
using System.Reflection;

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 edvV_DMR_OrderChangeOpenOrders_1View;
	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **
	EpiUltraGrid ordersGrid;
	int currentRow;

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		this.edvV_DMR_OrderChangeOpenOrders_1View = ((EpiDataView)(this.oTrans.EpiDataViews["V_DMR_OrderChangeOpenOrders_1View"]));
		this.MainController.BeforeToolClick += new Ice.Lib.Framework.BeforeToolClickEventHandler(this.MainController_BeforeToolClick);
		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls
		ordersGrid = (EpiUltraGrid)csm.GetNativeControlReference("4ce14d84-9db9-489f-a95e-4254dc3ef1b4");
		this.btnSelectAll.Click += new System.EventHandler(this.btnSelectAll_Click);
		this.btnUnselect.Click += new System.EventHandler(this.btnUnselect_Click);
		this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);
		
		this.btnSubmitRequest.Click += new System.EventHandler(this.btnSubmitRequest_Click);
		this.ordersGrid.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.ordersGrid_AfterCellUpdate);
		// 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.edvV_DMR_OrderChangeOpenOrders_1View = null;

		this.btnSelectAll.Click -= new System.EventHandler(this.btnSelectAll_Click);
		this.btnUnselect.Click -= new System.EventHandler(this.btnUnselect_Click);
		this.btnCopy.Click -= new System.EventHandler(this.btnCopy_Click);
		this.MainController.BeforeToolClick -= new Ice.Lib.Framework.BeforeToolClickEventHandler(this.MainController_BeforeToolClick);
		this.btnSubmitRequest.Click -= new System.EventHandler(this.btnSubmitRequest_Click);
		this.ordersGrid.AfterCellUpdate -= new Infragistics.Win.UltraWinGrid.CellEventHandler(this.ordersGrid_AfterCellUpdate);
		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal
		ordersGrid = null;
		currentRow = 0;
		// End Custom Code Disposal
	}

	private void MainController_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
		if(MainController.LaunchFormOptions != null)
		{
			int orderNum;
			string val = MainController.LaunchFormOptions.ValueIn.ToString();
			
			if (val.Contains("~"))
			{
				string[] items = val.Split('~');
				orderNum = Convert.ToInt32(items[0]);
			}
			else
			{
				orderNum = Convert.ToInt32(val);
			}

			edvV_DMR_OrderChangeOpenOrders_1View.dataView.RowFilter += "OrderRel_OrderNum = " + orderNum.ToString();
		}
	}



	private void btnSelectAll_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		if (edvV_DMR_OrderChangeOpenOrders_1View.dataView.Count > 0)
		{
			for (int i = 0; i < edvV_DMR_OrderChangeOpenOrders_1View.dataView.Count; i++)
			{
				edvV_DMR_OrderChangeOpenOrders_1View.dataView[i]["Calculated_ChangeRelease"] = true;
				edvV_DMR_OrderChangeOpenOrders_1View.dataView[i]["RowMod"] = "U";
			}
			oTrans.NotifyAll();
		}
	}
	

	private void btnUnselect_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		if (edvV_DMR_OrderChangeOpenOrders_1View.dataView.Count > 0)
		{
			for (int i = 0; i < edvV_DMR_OrderChangeOpenOrders_1View.dataView.Count; i++)
			{
				edvV_DMR_OrderChangeOpenOrders_1View.dataView[i]["Calculated_ChangeRelease"] = false;
				edvV_DMR_OrderChangeOpenOrders_1View.dataView[i]["RowMod"] = "U";
			}
			oTrans.NotifyAll();
		}
	}

	private void btnCopy_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		if (edvV_DMR_OrderChangeOpenOrders_1View.dataView.Count > 0)
		{
			string changeType = (string)cmbChangeType.Value;
			string changeOrigin = (string)cmbChngOrigin.Value;
			string comments = txtChangeNotes.Text;
			DateTime proposedDate = (DateTime)dteProposed.Value;

			for (int i = 0; i < edvV_DMR_OrderChangeOpenOrders_1View.dataView.Count; i++)
			{
				if ((Boolean)edvV_DMR_OrderChangeOpenOrders_1View.dataView[i]["Calculated_ChangeRelease"])
				{
					edvV_DMR_OrderChangeOpenOrders_1View.dataView[i]["Calculated_ChangeType"] = changeType;
					edvV_DMR_OrderChangeOpenOrders_1View.dataView[i]["Calculated_ChangeOrigin"] = changeOrigin;
					edvV_DMR_OrderChangeOpenOrders_1View.dataView[i]["Calculated_Comments"] = comments;
					edvV_DMR_OrderChangeOpenOrders_1View.dataView[i]["Calculated_ProposedDate"] = proposedDate;
					edvV_DMR_OrderChangeOpenOrders_1View.dataView[i]["RowMod"] = "U";
				}
			}
		}
		oTrans.NotifyAll();

	}

	private void MainController_BeforeToolClick(object sender, Ice.Lib.Framework.BeforeToolClickEventArgs args)
	{
		if (args.Tool.Key == "SaveMenuTool")
		{
			for (int i = 0; i < ordersGrid.Rows.Count; i++)
			{
				ordersGrid.Rows[i].Selected = false;
			}
			this.ordersGrid.Update();

		}
	}

	private void btnSubmitRequest_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		for (int i = 0; i < ordersGrid.Rows.Count; i++)
		{
			ordersGrid.Rows[i].Selected = false;
		}
		this.ordersGrid.Update();
	
		MainController.AppControlPanel.HandleToolClick("SaveTool", new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["SaveTool"], null));
		MainController.Close();
	}

	private void ordersGrid_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs args)
	{
		// ** Place Event Handling Code Here **
	}
}

Go change your update code to pop up an infomessage for rows count with rowmod U.
(in baq bpm)

image

5 rows instead of 6.
Simply by me clicking off the first row (default row) onto a different row is enough that all my rows go into the Update.

I’m not seeing anything in your code that raises red flags. May be some kind of bug.

Comment out the code everywhere where you are selecting/deselecting rows.
Leave that poor grid alone and let’s see where it goes.

	private void MainController_BeforeToolClick(object sender, Ice.Lib.Framework.BeforeToolClickEventArgs args)
	{
		/*
		if (args.Tool.Key == "SaveMenuTool")
		{
			for (int i = 0; i < ordersGrid.Rows.Count; i++)
			{
				ordersGrid.Rows[i].Selected = false;
			}
			this.ordersGrid.Update();

		}
		*/
	}

	private void btnSubmitRequest_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		/*
		for (int i = 0; i < ordersGrid.Rows.Count; i++)
		{
			ordersGrid.Rows[i].Selected = false;
		}
		this.ordersGrid.Update();
		*/
	
		MainController.AppControlPanel.HandleToolClick("SaveTool", new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["SaveTool"], null));
		MainController.Close();
	}