Possible solution for silent BAQ parameter passing (working now)

UPDATE Alex’s reply below links to an erp-function way of pumping the parameters to the baq, and so long as you only set the dataview (Ep Binding) and not the BAQ ID in the grid model/provider model then the troublesome param popups stay away :trophy: :trophy: :trophy:

I’m tired of BAQs loading thousands of rows to the client to have it pick out the single row it needs there. Just about decided to only use BOs as they at least server side filter, but then they return too many columns, and don’t do the groupings, aggregations and calculations I might need. Many of our users will be across the Pacific and half the USA from our server here in NZ, so pumping large amounts of unwanted response data is especially undesirable.

So…
What if…

We allocate a single UD table to act as the the conduit to pass all “parameters” to all BAQs?

I have a spare UD table, UD05. My first BAQ I am testing it with is to be called from Customer Entry and its derivatives, so I’m want to filter within the BAQ down to a particular customer. Here’s my plan:

Filter UD05 to select the parameter I want (its value in this case is in Number01):

Join my query to it:

I will use 4 keys to identify a row in UD05 where I am passing the parameter.
Key1: The name of the BAQ this parameter is intended for.
Key2: The name of the parameter (in case i am passing multiple parameters)
Key3 and Key4 are the current UserID and WorkstationID to uniquify things and prevent collisions. (SessionID would have been nicer but can’t seem to access it as a special constant, but I think the userid/workstaionID should be sufficient to avoid parameter collisions between concurrent calls).

(I might rejig this and move BAQ name to to key 4 and the existing keys 2-4 up one, so that the BAQ name is optional- often have several BAQs firing in sequence all filtered off the same “parameter value(s)”, would be better then to set it once)

On the app studio side, before i call the baq-get, I will update-or-insert based on the 4 keys, and update in this case the Number01 field to the CustNum I require data for, and post and then I’m good to go and update from the baq(s).

Optionally at the end could delete the added row but probably not really necessary… UD05 will grow but not super fast and at least have some traceback, and can schedule it to be emptied weekly or something.

So… is this a silly idea? :woozy_face:

Anyway, the UD05 table is set to go, the baq looks to be working as expected ( I can manually populate UD05 with a suitable “key” to return a CustNum) , but I have fallen at the first hurdle in application studio: I cannot link a dataview to my UD table, and haven’t managed to find any examples here of it being done. Here’s what i have tried, but no columns appear:

image

I was planning on doing this to my UD05 dataview:

  • a row-find
  • then either a row-add or a row-update,
  • then a data-commit

then my baq-get.


Or maybe I can skip the dataview and do it with a rest-erp call? something like…
image

Feel like I might have gone down a rabbithole, I’m getting way out of my depth here…

drowning GIF

UPDATE: WorkstationID seems to be always blank, at least when running via the browser, so hopefully the userid key is sufficient, at least for our puposes to avoid collisions.

No.

I have some ideas for improvement/modification that I’ll get back to you on after some coffee:)

UPDATE suddenly the dataview “took”, and loaded the columns:

Don’t know how or why, but hey I’ll take a win where I can.

So then I thought I could sidestep the erp-rest calls (which I have struggled with refer Epicor Kinetic- rest-erp - #14 by Chrisw), and just do something along the lines of:

image

Looks OK, no errors, but nothing is written to the database.

I then tried adding an erp-update afterwards (I looked into my UD05 menu in application studio and thats how it saves) but then get :woozy_face:
image

So fair enough, there should be something in the payload to commit.

But when I look at the system generated Update call its params look the same as mine:

Theirs:

Mine:

You need to set your DataSetID to the one you have.

Thanks, some progress, but none of my added data still in the payload:
image

ctrl alt V on the dataview:

Maybe the commit is marking it as not dirty so not saving anything?

(and any pointers to anything discussing dataviews vs datasets, suspect dataview is a row in a dataset?)

Nope: getting rid of commit didn’t help

image

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