Hello everyone,
I have created my first BAQ Dataview in our quote form and it is all working really well. Thanks to this forum. So, I have created 3 BAQ dataview. And now I am wanting to have this baqs refresh when a new line is added. I have seen @josecgomez ’ solution from other topics but I could not make it work. Any help will be very much appreciated.
Here’s my code
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;
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 **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
BAQDataView QuoteMTLPriceListBAQDV;
BAQDataView MTLLabourCostBAQDV;
BAQDataView QuoteMarkUpBAQDV;
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
CreateQuoteMTLPriceListBAQview();
CreateMTLLabourCostBAQview();
CreateQuoteMarkUpBAQview();
}
public void CreateQuoteMTLPriceListBAQview() {
QuoteMTLPriceListBAQDV = new BAQDataView("QuoteMTLPriceList");
oTrans.Add("QuoteMaterialsPricelist", QuoteMTLPriceListBAQDV);
string pub1Binding = "QuoteHed.QuoteNum";
IPublisher pub1 = oTrans.GetPublisher(pub1Binding);
if (pub1 == null)
{
string pubName = Guid.NewGuid().ToString();
oTrans.PublishColumnChange(pub1Binding, pubName);
pub1 = oTrans.GetPublisher(pub1Binding);
}
if (pub1 != null)
QuoteMTLPriceListBAQDV .SubscribeToPublisher(pub1.PublishName, "QuoteDtl1_QuoteNum");
string pub2Binding = "QuoteDtl.QuoteLine";
IPublisher pub2 = oTrans.GetPublisher(pub2Binding);
if (pub2 == null)
{
string pubName = Guid.NewGuid().ToString();
oTrans.PublishColumnChange(pub2Binding, pubName);
pub2 = oTrans.GetPublisher(pub2Binding);
}
if (pub2 != null)
QuoteMTLPriceListBAQDV .SubscribeToPublisher(pub2.PublishName, "QuoteDtl1_QuoteLine");}
public void CreateMTLLabourCostBAQview() {
MTLLabourCostBAQDV = new BAQDataView("ICQuoteMTLCost");
oTrans.Add("MaterialLabourCost", MTLLabourCostBAQDV);
string pub1Binding = "QuoteHed.QuoteNum";
IPublisher pub1 = oTrans.GetPublisher(pub1Binding);
if (pub1 == null)
{
string pubName = Guid.NewGuid().ToString();
oTrans.PublishColumnChange(pub1Binding, pubName);
pub1 = oTrans.GetPublisher(pub1Binding);
}
if (pub1 != null)
MTLLabourCostBAQDV .SubscribeToPublisher(pub1.PublishName, "QuoteDtl1_QuoteNum");
string pub2Binding = "QuoteDtl.QuoteLine";
IPublisher pub2 = oTrans.GetPublisher(pub2Binding);
if (pub2 == null) {
string pubName = Guid.NewGuid().ToString();
oTrans.PublishColumnChange(pub2Binding, pubName);
pub2 = oTrans.GetPublisher(pub2Binding); }
if (pub2 != null)
MTLLabourCostBAQDV .SubscribeToPublisher(pub2.PublishName, "QuoteDtl1_QuoteLine");}
public void CreateQuoteMarkUpBAQview()
{
QuoteMarkUpBAQDV = new BAQDataView("QuotePricelist");
oTrans.Add("MarkUp", QuoteMarkUpBAQDV);
string pub1Binding = "QuoteHed.QuoteNum";
IPublisher pub1 = oTrans.GetPublisher(pub1Binding);
if (pub1 == null)
{
string pubName = Guid.NewGuid().ToString();
oTrans.PublishColumnChange(pub1Binding, pubName);
pub1 = oTrans.GetPublisher(pub1Binding);
}
if (pub1 != null)
QuoteMarkUpBAQDV .SubscribeToPublisher(pub1.PublishName, "QuoteDtl_QuoteNum");
string pub2Binding = "QuoteDtl.QuoteLine";
IPublisher pub2 = oTrans.GetPublisher(pub2Binding);
if (pub2 == null)
{
string pubName = Guid.NewGuid().ToString();
oTrans.PublishColumnChange(pub2Binding, pubName);
pub2 = oTrans.GetPublisher(pub2Binding);
}
if (pub2 != null)
QuoteMarkUpBAQDV .SubscribeToPublisher(pub2.PublishName, "QuoteDtl_QuoteLine");
}
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
})