Possible solution for silent BAQ parameter passing (working now)

set the rowmod in row-update

I know you want to make this work, and I do too, but I would move everything I can to functions.

I also know you’re trying to learn functions, Hopefully some of the reading material @Mark_Wonsil provided will be helpful.

I sure do.
Wasn’t familiar with rowmod, some googling suggested it should be set to ‘A’ (for “add”?), so I did that in the update:
image

I changed the case as that’s what googling suggested, but the fact it doesn’t show up in the dataview columns I thought it would barf; it didn’t but still me dataview refuses to save, still empty payload as above.

I’ll have to play with it later.

Hold the phone!

image
and

(doing a little dance)

Needed this in the Rest Arguments
image

Needs a bit more work but Silent BAQ Parameter Passing is working :grinning:

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

Thanks for your help too @klincecum !

The BAQ server side filtering via the UD05 join :


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:

2 Likes

Maybe I don’t understand your requirement, I feel there is a simpler way to do this, as explained in this post.

Long story short:

Use the rest-erp widget
image

image

Configure the rest service
image

image

Here is where you setup your BAQ parameters
image

Json syntax, to pass multiple parameters (as explained in the linked post above)
image

Define in which dataView the BAQ result will be saved

1 Like

That is a lot simpler… I had been searching for a way to pass params to baqs without the slideout parameter panels appearing.

However: If I have a grid linked to a baq, won’t the native mechanisms still fire and pop up the parameter entry dialogs?

As soon as I put baq parameters in, those parameter entry dialogs start sliding in and i really don’t want them!

So this was a way to communicate virtual parameters to the baq without using the built in parameters, which carry the burden of unwanted dialogs.

Chris

It looks like you might be hunting something?

image

Sounds like a job for SysTag to me.

More to foogle? (Typo, but I like it)

Regards,
Chris Were

Why foogle when I’m so quick?

I use all 3 flavors:

1 Like

I was quicker, just read it :nerd_face:

Soooo….

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.

Haven’t thought it all the way through, but I’m sure a good solution is in there somewhere.

Nice thing about SysTag is it’s indexed and very fast.

Who cares! clean it up whenever lol

Hmm… UD tables should also be indexed by their keys though…. right?

Regards,
Chris Were

probably

Loving the UD05 solution for now!

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:

The UD05_DateRange subquery:

@Chrisw we found an interesting method were we used a function//dynamic query combo. It’s works really well and can be repurposed / reused.

Here’s the link:
How to: BAQ parameter dashboards

Hope this helps.

1 Like

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.

Functions! New fun. :slight_smile:

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:

image


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;

Nicely done !

Yeah by binding the data view to the grid model the UI grid doesn’t execute the query upon initialization ( like if the BAQ was the bound datasource.

Another benefit is you get around the paging affect within the UI.