I am trying to add the promise date of a PO to the related>PO’s tab in Project Entry. I followed some tutorials and I got some code that seems very close to working but doesn’t. It makes the column for promise date but doesn’t populate it with anything. Here is the code I wrote. The lines commented out are other things I tried that don’t work either but could have been in the right direction. (I also took out the wizard lines to make it more compact here)
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.Contracts;
using Ice.Core;
using Ice.Proxy.Lib;
public class Script
{
Ice.Lib.Framework.EpiUltraGrid myGrid;
BOReaderImpl myReader;
The code compiles fine and looks similar to what other people have done so it seems like I’m missing something small. Does anyone know where I’m going wrong?
Thanks,
Brian
edit: I saw someone had gotten something similar to what I am trying to achieve with a BAQDataView but I didn’t have Ice.Lib.Broadcast so I couldn’t use the publish/subscribe commands.
You want to use a BAQDataView … doing it this way is extremely slow since you are doing a lookup on the DB for each row. There is an example of doing with a BAQDataView here
I actually saw that post but I couldn’t use Ice.Lib.Broadcast.
I tried adding it as an assembly reference but the closest thing I found was Ice.Lib.BroadcastTower.dll and it was already referenced.
I implemented the BAQ view but when I open the customization it says an exception has been thrown and that length cannot be less than zero.
The line that causes the error is oTrans.PublishColumnChange(pubBinding, “MyCustomPublish”);
my pubBinding is “ProjectPO”
also do you know which .dll file has otrans information in it?
oTrans “information” is unique to each transaction. oTrans is an object of Type EpiTransaction from EpiClientLib.
That Error could be cause there is no publisher for PRojectPO? I’d have to see the rest of the code.
I see what I was doing wrong. so the code works, when I open the customization there are no errors, it shows the correct columns in my grid… but the POs aren’t getting filled in. the BAQ is just returning any results with a project ID assigned on the release level.
Your Publish / Subscribe isn’t working right… you should probably Publish Subcribe to Project.ProjectID and not the POProject view…
What does your whole code look like?
I had changed it to Project.ProjectID before my last post, sorry I wasn’t clear about that.
// **************************************************
// Custom code for ProjectEntryForm
// Created: 3/8/2017 2:08:48 PM
// **************************************************
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.Contracts;
using Ice.Core;
using Ice.Proxy.Lib;
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 **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
BAQDataView baqViewPOs;
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
CreatePOBAQView();
}
public void CreatePOBAQView()
{
baqViewPOs = new BAQDataView("ProjectEntryPOView");
oTrans.Add("ProjectEntryPOViewBAQ",baqViewPOs);
string pubBinding = "Project.ProjectID";
IPublisher pub = oTrans.GetPublisher(pubBinding);
if(pub==null)
{
oTrans.PublishColumnChange(pubBinding, "MyCustomPublish");
pub = oTrans.GetPublisher(pubBinding);
}
if(pub !=null)
baqViewPOs.SubscribeToPublisher(pub.PublishName, "PORel_ProjectID");
}
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
}
I figured out what the issue was. One of my columns was due date and the PO’s attached to the project I was testing didn’t have due dates. Can I make it so it shows the BAQ results even if a field is empty?
Testing with 3836 didn’t work but 3837 did.
thats the BAQ from the designer btw
I mean the grid doesn’t care if the field is empty or not… if you want the PO to show even if there is no DUeDate just make sure that’s not a requirement within the BAQ