I have created a BAQ Data View that I would like to be able to subscribe to a text box in my Dashboard. This is just a free form text box that when a customer ID is entered into it the BAQ Data View will subscribe to it and reset the DataView. @josecgomez helped me with the Data View.
//Customer - Customer Data View
private void CreateCustomerBAQView()
{
GS_Customer_DataView = new BAQDataView("GS_Customer_DataView");
oTrans.Add("GS_Customer_DataView", GS_Customer_DataView);
var CustID = tbCustomerIDRef.Text.ToString(); //This is where I need it to subscribe to text box - this doesn't seem to work.
oTrans.PublishColumnChange(CustID, Guid.NewGuid().ToString());
var CustIDPub = oTrans.GetPublisher(CustID);
GS_Customer_DataView.SubscribeToPublisher(CustIDPub.PublishName, "Customer_CustID");
}
So to do that you’ll have to create a DataView and bind that to your TextBox. Try this
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("CustID",typeof(string));
dt.Columns.Add(new DataColumn("SysRowID",typeof(Guid));
var r = dt.NewRow();
dt.Rows.Add(r);
EpiDataView edvMyCustomDV = new EpiDataView();
edvMyCustomDV.dataView = dt.DefaultView;
oTrans.Add("MyCustomView",edvMyCustomDV);
Once this runs for the first time (in initilize custom code) you should have a new data view in your dashboard called MyCustomView which you can bind to your TextBox. Then you can use the Publish Subscribe code above to publish changes tol your new cust ID field as
var CustID = "MyCustomView.CustID"; //This is where I need it to subscribe to text box - this doesn't seem to work.
Okay something isn’t right. The Data View is showing up. I bound the text box to the new data view. Then when I enter a valid customer number and leave the box I have it setup to reset the data view. It is resetting the data view but it is just finding the first record and not the matching record in the BAQ Data View.
Are you adding the new view before your BAQ View? (Order matters)
By the way you shouldn’t have to force it to refresh the publish / subscribe should take care of that for you
It is in the correct order now and working perfectly. I also removed the on leave refresh and that is working perfectly! Thank you so much as always. I really like these BAQ Data View’s vs. using a Dashboard, they seem so much faster and elegant!
Okay one more question. I have a search which populates this text box with a Customer ID. How can I get the view to refresh without the user having to tab out of the box
Any thoughts on why an updatable dashboard that I am having subscribe to the Order Data View wouldn’t be working? It doesn’t respond when I enter an order number?