E10 Execute BAQ In Customization

Would it be possible to display this DataSet in a search window and return the selected values?  I have been working with the Simple Search wizard, but the search adapter I'm using does not have all the required fields that I need displayed.  I have set up a BAQ for the information I need but, have not found a way to pass the current ShipDtl.OrderNum value to be used as a parameter, so no results are returned.  So far the best way I have found is a Names Search with my BAQ, but requires the user to enter the OrderNum each time they search when adding a line the the Customer Shipment.
        

Hey everyone,


We are in the process of upgrading from Vantage 8 to E10 and I have a question about executing a BAQ in a customization now because it appears the old way has been removed. This is the old code that worked fine and had no issues.


              Dim baq As New Epicor.Mfg.BO.DynamicQuery(UD01Form.Session.ConnectionPool)
              Dim dsDQ As Epicor.Mfg.BO.DynamicQueryDataSet
              Dim ds2 As System.Data.DataSet
              Dim RetRows() as datarow
              Dim Rework as boolean

              dsDQ = baq.GetDashBoardQuery("JBIS-JobPerformance")
              dsDQ.QueryWhereItem(0).RValue = "JBIS"
              dsDQ.QueryWhereItem(1).RValue = True
              dsDQ.QueryWhereItem(2).RValue = dteStartDate.Text
              dsDQ.QueryWhereItem(3).RValue = dteEndDate.Text
              ds2 = baq.ExecuteDashBoardQuery(dsDQ)


My question is what replaced ConnectionPool as its no longer there and ExecuteDashboardQuery is gone as well. Any help would be appreciated, also this is all being done still in VB.Net

I see the problem..., you are using VB *grin*

all joking aside the code is similar though not exactly the same. Also it looks like you are replacing the "where" items, I recommend that you move to using a Parameter its much cleaner and easier to maintain plus you don't have rely on the order of the parameters remaining the same.

Here is the code you'll need, I also did a quick screen cap explaining how it works (if you want to know more)

DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
dqa.BOConnect();
QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("MyBAQ");
qeds.ExecutionParameter.Clear();
qeds.ExecutionParameter.AddExecutionParameterRow("PartParam", txtParam.Text , "nvarchar",false, Guid.NewGuid(),"A");
dqa.ExecuteByID("MyBAQ",qeds);
ugMyGrid.DataSource = dqa.QueryResults.Tables["Results"];



Hope this helps!



Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Wed, Jan 28, 2015 at 9:19 AM, amathis@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p><span>Â Â Â Â </span><span>Â Â Â Â </span></p><p><span></span></p><p>Hey everyone,</p><p><br></p><p>We are in the process of upgrading from Vantage 8 to E10 and I have a question about executing a BAQ in a customization now because it appears the old way has been removed. This is the old code that worked fine and had no issues.</p><p><br></p><p>Â Â Â Â Â Â Â Â Â Â Â Â Â  Dim baq As New Epicor.Mfg.BO.DynamicQuery(UD01Form.Session.ConnectionPool)<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  Dim dsDQ As Epicor.Mfg.BO.DynamicQueryDataSet<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  Dim ds2 As System.Data.DataSet<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  Dim RetRows() as datarow<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  Dim Rework as boolean</p><p>Â Â Â Â Â Â Â Â Â Â Â Â Â  dsDQ = baq.GetDashBoardQuery(&quot;JBIS-JobPerformance&quot;)<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  dsDQ.QueryWhereItem(0).RValue = &quot;JBIS&quot;<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  dsDQ.QueryWhereItem(1).RValue = True<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  dsDQ.QueryWhereItem(2).RValue = dteStartDate.Text<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  dsDQ.QueryWhereItem(3).RValue = dteEndDate.Text<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  ds2 = baq.ExecuteDashBoardQuery(dsDQ)</p><p><br></p><p>My question is what replaced ConnectionPool as its no longer there and ExecuteDashboardQuery is gone as well. Any help would be appreciated, also this is all being done still in VB.Net</p><p></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>

Thank you for the reply. The where is there because we have a date range they insert and then filter by. Can I still do that with what you are saying? And well we are coming from vantage 8 straight to E10, to convert everything to C# now would take months, its something that will be done, but once we are up and running lol.

Yeah just just the parameter the same way. I showed you in the video

On Jan 28, 2015 10:39 AM, "amathis@... [vantage]" <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>Thank you for the reply. The where is there because we have a date range they insert and then filter by. Can I still do that with what you are saying? And well we are coming from vantage 8 straight to E10, to convert everything to C# now would take months, its something that will be done, but once we are up and running lol.</p>

</div>
 


<div style="color:#fff;min-height:0;"></div>
Can you not do it anymore using the Query where item? Only reason I ask is with what you are suggesting and I am going to have to go into all my BAQs update them, and then update the code as well. If that's what has to be done then I will, but we aren't trying to just get everything up and running, then we will have time to do things effectively and accurately. Thank you also for your help too!

Yes you can still use the where items however in the import process the order in which those items belong to the BAQ will probably change. So you're going to run into the issue where your code says: item 0 and it really is now where item 2. But if you want to do it that portion of the code should work the same. Simply replace the where items in your query execution data set like you did before

On Jan 28, 2015 10:47 AM, "amathis@... [vantage]" <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>Can you not do it anymore using the Query where item? Only reason I ask is with what you are suggesting and I am going to have to go into all my BAQs update them, and then update the code as well. If that&#39;s what has to be done then I will, but we aren&#39;t trying to just get everything up and running, then we will have time to do things effectively and accurately. Thank you also for your help too!</p>

</div>
 


<div style="color:#fff;min-height:0;"></div>
Ok so I guess I will try it your way since it seems to be the correct way. Could you show me an example where the user inputs a date range, so 2 dates? That would help me immensely, especially since I've been using this software for only a few months now. I am on the JobHead table and using JobCompletionDate as the date that will have a range, (09/01/2014 to 09/30/2014) just as an example. Thanks again for helping me!
Also, the import process did not change anything also, so if its easier to do the Where stuff. I feel like I am so close with it, it just needs like one or two lines changed, which I would prefer, but if it can't be done that's fine

I saw someone doing this,                 Ice.Proxy.BO.DynamicQueryImpl _dynQry = Ice.Lib.Framework.WCFServiceSupport.CreateImpl<Ice.Proxy.BO.DynamicQueryImpl>((Ice.Core.Session)epiSession, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.DynamicQuerySvcContract>.UriPath);


That's pretty much all I need to make mine work really, without any extra work or messing with BAQs right?

That should work

On Jan 28, 2015 11:10 AM, "amathis@... [vantage]" <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p><p>I saw someone doing this,                 Ice.Proxy.BO.DynamicQueryImpl _dynQry = Ice.Lib.Framework.WCFServiceSupport.CreateImpl&lt;Ice.Proxy.BO.DynamicQueryImpl&gt;((Ice.Core.Session)epiSession, Epicor.ServiceModel.Channels.ImplBase&lt;Ice.Contracts.DynamicQuerySvcContract&gt;.UriPath);</p><p><br></p><p>That&#39;s pretty much all I need to make mine work really, without any extra work or messing with BAQs right?<br></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>

However I am a firm believer on if you are going to do it, do it right :)

On Jan 28, 2015 11:17 AM, "Jose Gomez" <jose@...> wrote:

That should work

On Jan 28, 2015 11:10 AM, "amathis@... [vantage]" <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p><p>I saw someone doing this,                 Ice.Proxy.BO.DynamicQueryImpl _dynQry = Ice.Lib.Framework.WCFServiceSupport.CreateImpl&lt;Ice.Proxy.BO.DynamicQueryImpl&gt;((Ice.Core.Session)epiSession, Epicor.ServiceModel.Channels.ImplBase&lt;Ice.Contracts.DynamicQuerySvcContract&gt;.UriPath);</p><p><br></p><p>That&#39;s pretty much all I need to make mine work really, without any extra work or messing with BAQs right?<br></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>

I completely agree, but when Epicor gives a crazy deadline, sometimes you just have to make things work, believe me I'd rather do it right ! Also I have this now, but I am pretty sure the line I bolded is wrong. Any ideas?


Dim dynQry As Ice.Proxy.BO.DynamicQueryImpl = Ice.Lib.Framework.WCFServiceSupport.CreateImpl<Ice.Proxy.BO.DynamicQueryImpl>((Ice.Core.Session)epiSession, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.DynamicQuerySvcContract>.UriPath)
     Dim dsDQ As Ice.BO.DynamicQueryDataSet
     Dim dsEx as Ice.BO.QueryExecutionDataSet
              Dim ds2 As System.Data.DataSet
              Dim RetRows() as datarow
              Dim Rework as boolean

              dsDQ = dynQry.GetByID("JBIS-JobPerformance")
              dsDQ.QueryWhereItem(0).RValue = "JBIS"
              dsDQ.QueryWhereItem(1).RValue = True
              dsDQ.QueryWhereItem(2).RValue = dteStartDate.Text
              dsDQ.QueryWhereItem(3).RValue = dteEndDate.Text
     dsDQ.AcceptChanges()
              ds2 = baq.Execute(dsDQ, dsEx)


Everything else is correct I believe.

This should work

DynamicQueryImpl dq;
dq = WCFServiceSupport.CreateImpl<Ice.Proxy.BO.DynamicQueryImpl>((Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.DynamicQuerySvcContract>.UriPath);

On Jan 28, 2015 11:26 AM, "amathis@... [vantage]" <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p><p>I completely agree, but when Epicor gives a crazy deadline, sometimes you just have to make things work, believe me I&#39;d rather do it right ! Also I have this now, but I am pretty sure the line I bolded is wrong. Any ideas?</p><p><br></p><p><strong>Dim dynQry As Ice.Proxy.BO.DynamicQueryImpl = Ice.Lib.Framework.WCFServiceSupport.CreateImpl&lt;Ice.Proxy.BO.DynamicQueryImpl&gt;((Ice.Core.Session)epiSession, Epicor.ServiceModel.Channels.ImplBase&lt;Ice.Contracts.DynamicQuerySvcContract&gt;.UriPath)</strong><br>Â Â Â Â  Dim dsDQ As Ice.BO.DynamicQueryDataSet<br>Â Â Â Â  Dim dsEx as Ice.BO.QueryExecutionDataSet<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  Dim ds2 As System.Data.DataSet<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  Dim RetRows() as datarow<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  Dim Rework as boolean</p><p>Â Â Â Â Â Â Â Â Â Â Â Â Â  dsDQ = dynQry.GetByID(&quot;JBIS-JobPerformance&quot;)<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  dsDQ.QueryWhereItem(0).RValue = &quot;JBIS&quot;<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  dsDQ.QueryWhereItem(1).RValue = True<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  dsDQ.QueryWhereItem(2).RValue = dteStartDate.Text<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  dsDQ.QueryWhereItem(3).RValue = dteEndDate.Text<br>Â Â Â Â  dsDQ.AcceptChanges()<br>Â Â Â Â Â Â Â Â Â Â Â Â Â  ds2 = baq.Execute(dsDQ, dsEx)</p><p><br></p><p>Everything else is correct I believe.<br></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>

Ok, so I did that and received some errors. Here's what I have

Dim dynQry As Ice.Proxy.BO.DynamicQueryImpl
     dynQry = WCFServiceSupport.CreateImpl<Ice.Proxy.BO.DynamicQueryImpl>((Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.DynamicQuerySvcContract>.UriPath)


and received these errors:

 Error: BC30456 - line 71 (335) - 'WCFServiceSupport' is not a member of 'BO'.
 Error: BC30691 - line 71 (335) - 'DynamicQueryImpl' is a type in 'BO' and cannot be used as an expression.
 Error: BC30451 - line 71 (335) - 'Session' is not declared. It may be inaccessible due to its protection level.
 Error: BC30198 - line 71 (335) - ')' expected.

using Ice.Proxy.BO;
using Ice.Core;
using Ice.BO;

Bring in core.session dll too

I was trying to save you from all this lol

On Jan 28, 2015 11:34 AM, "amathis@... [vantage]" <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p><p>Ok, so I did that and received some errors. Here&#39;s what I have<br><br>Dim dynQry As Ice.Proxy.BO.DynamicQueryImpl<br>Â Â Â Â  dynQry = WCFServiceSupport.CreateImpl&lt;Ice.Proxy.BO.DynamicQueryImpl&gt;((Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase&lt;Ice.Contracts.DynamicQuerySvcContract&gt;.UriPath)</p><p><br></p><p>and received these errors:</p><p>Â Error: BC30456 - line 71 (335) - &#39;WCFServiceSupport&#39; is not a member of &#39;BO&#39;.<br>Â Error: BC30691 - line 71 (335) - &#39;DynamicQueryImpl&#39; is a type in &#39;BO&#39; and cannot be used as an expression.<br>Â Error: BC30451 - line 71 (335) - &#39;Session&#39; is not declared. It may be inaccessible due to its protection level.<br>Â Error: BC30198 - line 71 (335) - &#39;)&#39; expected.<br></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>

Also since of those errors are related to vb vs c# the code I am sending you its c#

On Jan 28, 2015 11:38 AM, "Jose Gomez" <jose@...> wrote:

using Ice.Proxy.BO;
using Ice.Core;
using Ice.BO;

Bring in core.session dll too

I was trying to save you from all this lol

On Jan 28, 2015 11:34 AM, "amathis@... [vantage]" <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p><p>Ok, so I did that and received some errors. Here&#39;s what I have<br><br>Dim dynQry As Ice.Proxy.BO.DynamicQueryImpl<br>Â Â Â Â  dynQry = WCFServiceSupport.CreateImpl&lt;Ice.Proxy.BO.DynamicQueryImpl&gt;((Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase&lt;Ice.Contracts.DynamicQuerySvcContract&gt;.UriPath)</p><p><br></p><p>and received these errors:</p><p>Â Error: BC30456 - line 71 (335) - &#39;WCFServiceSupport&#39; is not a member of &#39;BO&#39;.<br>Â Error: BC30691 - line 71 (335) - &#39;DynamicQueryImpl&#39; is a type in &#39;BO&#39; and cannot be used as an expression.<br>Â Error: BC30451 - line 71 (335) - &#39;Session&#39; is not declared. It may be inaccessible due to its protection level.<br>Â Error: BC30198 - line 71 (335) - &#39;)&#39; expected.<br></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>

Ok, did all that and now I have this:

 Error: BC30455 - line 73 (338) - Argument not specified for parameter 'session' of 'Public Shared Function CreateImpl(Of T As Epicor.ServiceModel.Channels.ImplBase)(session As Ice.Core.Session, uriPath As String) As T'.
 Error: BC30455 - line 73 (338) - Argument not specified for parameter 'uriPath' of 'Public Shared Function CreateImpl(Of T As Epicor.ServiceModel.Channels.ImplBase)(session As Ice.Core.Session, uriPath As String) As T'.
 Error: BC30691 - line 73 (338) - 'DynamicQueryImpl' is a type in 'BO' and cannot be used as an expression.
 Error: BC30108 - line 73 (338) - 'Session' is a type and cannot be used as an expression.
 Error: BC30198 - line 73 (338) - ')' expected.


I know you were trying to save me lol, but its also good to see this so when I go back to fix them I know at least whats going on.

I will go from here, thanks again. I imagine playing with this should eventually get me something.
Alright, well I will mess around with this then. and see what I can come up with. Thanks again for helping.