Needs a bit more work but Silent BAQ Parameter Passing is working
My customer support page now loads only the machines (we use Project to represent these) and the supports cases releavant (HDCase). In the latter case that means tens to a hundred or so cases get passed down the wire to the client instead of 20,000.
With a 200ms latency, typical of what our USA users experience, that’s a fraction of a second to load up a customer support page rather than 10 or more seconds.
HOWEVER
There are some timing issues. If my panel grids are “expand at runtime” then they seem to autopopulate asynchronously from the other events.
I was setting up UD05 with the CustNum param in after AfterGetByID, however sometimes the grid BAQs fire before my event completes. I’ll play with it some more tomorrow, maybe try activating it in before AfterGetByID. A workaround I’m not entitrely happy with is to have the panels collapsed at runtime, if I setup UD05 on expand it works every time.
Curiously (?) Ctrl-Alt-9 does not show the events firing that trigger the ExecuteBaq calls, so I can’t quite figure out conclusively what order things happen under the hood as the page loads. Bit annoying.
Todo:
Sort out timing
try to package into an Epicor function as suggested by @Mark_Wonsil
Using the Character01 to store the integer CustNum as using Number01 was 100% reliable in the Kinetic BAQ designer, but only worked 50% of the time with ExecuteBAQ calls, some sort of float rounding I guess?
(Can also filter on key4 as a “function filter” such as the target BAQ name, but leaving it open for now. I should have named my parameter (Key1) CustNum not CurrentOwner too, better decsribes what it is esp in the case context)
Application studio keeps corrupting this too so amazed it works. I can’t figure out how to make a success link to widgets already on the page either… so this is a bit of a mess:
Put a private tag on the “key” records (a customer record in this case). Join to it via systag table in the baq, then (maybe the hard part) make sure the tag is cleaned up immediately?
Would need to intercept each baq call ideally to bookend it with tag creation/deletion… but how would we do that?!?!
Could work like the ud table model i guess and leave the tag hanging around til next call; just remove all your private tags of a certain type ahead of creating a new one, so they purge on demand.
Just took a BAQ I struggled for weeks on, had 5 inner subqueries aggregating numbers from 5 different tables/conditions, and previously used 2 BAQ Params for specify the Period Start and End the aggregations ran over. Every time you did ANYTHING in the dashboard or custom Kinetic App I created with app wizard, you’d get the parmeter input slider appear.
Now just added a DateRange key to UD05 Key1, add another UD05 innersubquery to the report, and and doing my range filtering so:
That’s cool Alex, and a great description thanks. I see how the button calls the function, the function calls the baq get with parameters supplied and replaces the dataview content.
Does it prevent the Baq triggering its parameter popups if you sort by column/filter/or group on the results grid?
With the grid provided by the dataview, dataview linked to the baq still, it looks like it might still trigger the baq parameter input popups if the user interacts with the grid view? UPDATE looks like it won’t, is that because the Provider Model references the dataview only, and not the BAQ in its params? (When i created my application using app wizard it assigned both)
I’ll try a simple one with a single parameter function here.
Hi @ridgea I tried to follow your model, simplified for now to just pass a single parameter (CustNum) but tripped at entering the code, its giving me syntax errors (this my first attempt at any code in epicor btw, forgive me if I missed something obvious):
UPDATE, nevermind found it I think:
original errors:
System.Drawing.Bitmap
CS0234
The type or namespace name ‘DynamicQuerySvcContract’ does not exist in the namespace ‘Ice.Contracts’ (are you missing an assembly reference?)
System.Drawing.Bitmap
CS0234
The type or namespace name ‘QueryExecutionTableset’ does not exist in the namespace ‘Ice.Tablesets’ (are you missing an assembly reference?)
System.Drawing.Bitmap
CS0246
The type or namespace name ‘QueryExecutionTableset’ could not be found (are you missing a using directive or an assembly reference?)
System.Drawing.Bitmap
CS0246
The type or namespace name ‘ExecutionParameterRow’ could not be found (are you missing a using directive or an assembly reference?)
System.Drawing.Bitmap
CS0246
The type or namespace name ‘ExecutionParameterRow’ could not be found (are you missing a using directive or an assembly reference?)
My Code (basically yours):
CallService<Ice.Contracts.DynamicQuerySvcContract>(dQ =>
{
// Create a new instance of QueryExecutionTableset
Ice.Tablesets.QueryExecutionTableset dsQueryExecution = new QueryExecutionTableset();
// Create a new ExecutionParameterRow for the 'CustNum' parameter
ExecutionParameterRow drRow = null;
drRow = new ExecutionParameterRow();
drRow.ParameterID = "CustNum";
drRow.ParameterValue = this.CustNum;
drRow.ValueType = "nvarchar";
drRow.IsEmpty = String.IsNullOrEmpty(this.CustNum);
drRow.RowMod = "A";
drRow.SysRowID = new Guid();
// Add the 'CustNum' parameter to dsQueryExecution
dsQueryExecution.ExecutionParameter.Add(drRow);
// Execute the query using the BaqID and dsQueryExecution
this.returnObj = dQ.ExecuteByID(this.BaqID, dsQueryExecution);
});
Usings tab:
using Epicor.Customization.Bpm;
using Epicor.Data;
using Epicor.Hosting;
using Epicor.Utilities;
using Erp;
using Erp.Tables;
using Ice;
using Ice.Contracts;
using Ice.ExtendedData;
using Ice.Tables;
using Ice.Tablesets;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
@ridgea Can you explain this a little more? Because I am still getting the slideout.
I followed your PDF here, and I did indeed succeed in getting the BAQ to run without me (the human user) needing to enter anything. But the slideout still appears when I expand un unrelated panel card. See GIF below.
For the event, I actually hard-coded the input to the BAQ (well, the EFx that then runs the BAQ), but I mean, I could tie it to an input box or something.