BAQ EpiDataView

I have replaced the grid view in Order Release List with my own BAQ. All of the data in the columns are greyed out though. Is there a way to make them not be read only so I can make changes? I tried modify extended properties in customization but that did not work.

// **************************************************
// Custom code for SalesOrderForm
// Created: 8/24/2020 7:41:13 PM
// **************************************************

extern alias Erp_Adapters_SalesOrder;
extern alias Erp_Adapters_ReviewJrn;
extern alias Erp_Adapters_Customer;
extern alias Erp_Contracts_BO_ARInvoice;
extern alias Erp_Contracts_BO_Currency;
extern alias Erp_Contracts_BO_CashRec;
extern alias Erp_Contracts_BO_CashRecSearch;
extern alias Erp_Adapters_CashRec;
extern alias Erp_Adapters_Currency;


extern alias Erp_Contracts_BO_AlternatePart;
extern alias Erp_Contracts_BO_SalesOrder;
extern alias Erp_Contracts_BO_Quote;
extern alias Erp_Contracts_BO_Part;
extern alias Erp_Contracts_BO_Customer;
extern alias Erp_Contracts_BO_RMAProc;
extern alias Erp_Contracts_BO_OrderDtlSearch;
extern alias Erp_Contracts_BO_OrderHist;
extern alias Erp_Contracts_BO_QuoteDtlSearch;
extern alias Erp_Contracts_BO_SerialNumberSearch;
extern alias Erp_Contracts_BO_ShipTo;

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 **

	private EpiDataView edvOrderRel;
	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **
	BAQDataView baqOrderRel;
	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		this.edvOrderRel = ((EpiDataView)(this.oTrans.EpiDataViews["OrderRel"]));
		this.edvOrderRel.EpiViewNotification += new EpiViewNotification(this.edvOrderRel_EpiViewNotification);
		// Begin Wizard Added Custom Method Calls

		this.btnWindowTreat.Click += new System.EventHandler(this.btnWindowTreat_Click);
		// End Wizard Added Custom Method Calls
		CreateOrderRelBAQView();
	}

	public void CreateOrderRelBAQView()
	{
		baqOrderRel = new BAQDataView("OrderRelDataView");
		oTrans.Add("OrderRelBAQ",baqOrderRel);

		string pubBinding = "OrderHed.OrderNum";
		IPublisher pub = oTrans.GetPublisher(pubBinding);
		if(pub==null)
		{
			oTrans.PublishColumnChange(pubBinding, "MyCustomPublish");
			pub = oTrans.GetPublisher(pubBinding);
		}
		if(pub!=null)
		{
			baqOrderRel.SubscribeToPublisher(pub.PublishName, "OrderRel_OrderNum");
		}

		string pubBinding2 = "OrderDtl.OrderLine";
		IPublisher pub2 = oTrans.GetPublisher(pubBinding2);
		if(pub2==null)
		{
			oTrans.PublishColumnChange(pubBinding2, "MyCustomPublish2");
			pub2 = oTrans.GetPublisher(pubBinding2);
		}
		if(pub2!=null)
		{
			baqOrderRel.SubscribeToPublisher(pub2.PublishName, "OrderRel_OrderLine");
		}
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		this.btnWindowTreat.Click -= new System.EventHandler(this.btnWindowTreat_Click);
		this.edvOrderRel.EpiViewNotification -= new EpiViewNotification(this.edvOrderRel_EpiViewNotification);
		this.edvOrderRel = null;
		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

	private void btnWindowTreat_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		// TSG - Trigger update to save room number on release, if not yet saved.
		oTrans.Update();
		
		//EpiMessageBox.Show("Opening Window Treatment Entry");

		// TSG - Setting up launch form options to pass parameter values to Window Treatment UD Screen.
		LaunchFormOptions lfo = new LaunchFormOptions();
		lfo.ValueIn =  GenerateLFO("~");
		ProcessCaller.LaunchForm(oTrans, "Ice.UI.WinTreat", lfo);
	}

	private void edvOrderRel_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 string GenerateLFO(string strDelimiter)
	{
		string value = "";
		if (edvOrderRel.CurrentDataRow != null)
		{
			value += edvOrderRel.CurrentDataRow["OrderNum"].ToString();
			value += strDelimiter;

			value += edvOrderRel.CurrentDataRow["OrderLine"].ToString();
			value += strDelimiter;

			value += edvOrderRel.CurrentDataRow["OrderRelNum"].ToString();
		}
		return value;
	}
}

@NateS Align Dashboard Summary Columns

Could the solution you provided me to the post linked to center align the grid columns be used similarly to get the column to be read only set to false?

I don’t think so.

Is your BAQ updateable? I believe that unless you have set your BAQ to updatable, and then defined some fields for update, then you will always have just greyed out fields.

What reason do you need the fields to be editable?

I tried making it updatable but that still kept the fields greyed out. We tend to copy the list view to excel and make changes and then paste update or insert back in

Once the BAQ is updateable, does anything in the above code need to change?

Sorry! I can’t help you with this one! Good luck!

I am going into customization, tools, customization wizards, modify extended properties. Here I select the dataview, datafield, extended property: read only, value: false. It compiles perfectly fine. But when I open the order entry screen again, the field is still greyed out. Am I doing something wrong?

You can’t just make the field “Not read only” And have it write back to the database. The BAQ could conceivably return calculated, jumbled up rainbow cookies… And how would the computer know how to update that?

There is a lot of work in getting the grid to write back the the database, probably not something that is going to explainable is just a forum post.

Is there a way instead of attaching the BAQ to the grid, having the original grid include a column from another table? Only reason I created a BAQ was because I need another column from a different table to be included

It’s done is this post.

And none of those fields that you add would be updateable.

It would be great if you could explain more about what you are attempting. Sometimes we think we have the best approach, only to realize after days of headaches that the approach we took will never work. It might seem like a waste, but someone might understand what you are attempting to do, and offer you a better approach.
Good luck!

We have a configurator where one input field gets dropped to a column in Order Detail. Since configurators are not linked to the Order Release, I was hoping to just have that Order Detail column be on the Order Release list view as well somehow

Create a data directive BPM that copies the OrderDtl field value to the OrderRel table.

The timing of when an OrderRel table is created can be tricky, especially when the configurator is involved, so you might need a couple of BPMs.

  1. Data directive on the OrderDtl table that will copy the value to the corresponding OrderRel table.field when the value is changed from any to another.

  2. Data directive on the OrderRel table the fires when an OrderRel row is added. Retrieve value from OrderDtl table.