Multiple Grids Bound to same UD table

So I have several issues with dealing with grids bound to the same UD table.

First off the UD table houses different types of records pertaining to parts so Key1 is part number while the other keys differentiate different types of records. There are three types total.

I’ve abandoned using the standard GetNewUD02 method as it seems to be clearing the table when I click the plus button on one of the grids. (Also strange thing, is when I added the dataview, it didn’t give me a GetNewUD02 but added the plus symbol on the grid and when I clicked it, it called the GetNewUD02 as if it was set in the background but no parameters were passed. I had to create GetNewUD02 event to get it to work.) This is clearing out all of the grids on the screen and I’m not sure why that would be there. Also, the plus button is only available on one of the grids. I need it on ALL grids. So my first question is… how do I remove the plus button from the grid?

More importantly though is getting my custom buttons to work. I’ve added a button to add new (UD02) on one of the grids and I need to get the existing value of the Key3 (which is a counter for one of the types) and get the highest value so I can add 1 to it to set it in the new record. I don’t want to create a function for it, that is overkill. In .NET this literally would be less than 5 min and one line of code. So how do you query a UD table that is tied to your screen and set a value to a variable I can access?

No, a function isn’t overkill, that is literally how to do it.

If you have to create functions to query data that is already in the UI that is overkill and leads to unnecessary functions. It also creates more functions to maintain.

Welcome to kinetic.

1 Like

A few thoughts…

There are two methods on UD tables… GetNewUD02 and GetaNewUD02… I typically use the GetaNew method.

image

What form are you working on? Part Entry, for example?

On Part Entry (since I’ve wrestled that demon before), the New button is used across the application, but the event(s) include a “switch” of sorts. First the OnClick_ToolNew event triggers the GetNew event… but it does so by passing some parameters which sets the “dataview” and “getnewsuffix” to the dataview the new button was tied to.

In the middle of the GetNew event, there is an event-next with a value of:

GetNew{sysVariable.getNewSuffix}

This effectively runs a GetNew{currentdataview}… so if the new button was bound to Part, or PartRev… it would trigger GetNewPart, or GetNewPartRev.

In our case clicking the plus button on a grid bound to UD02… that becomes GetNewUD02

So.. this leads to answering another of your questions:

The plus button appears when your grid is tied to a DataView in the Grid Model.

If I delete that binding, my plus button disappears.

~*~

I have a very similar set-up (it sounds like) to what you’re trying to achieve. I use UD02 to track various external part references against a part record. Could be drawings, specifications, customer part numbers, vendor part numbers, various keywords we use for categorizing and searching. Primarily carryover from our Legacy system, but we built it out in Epicor when we transitioned.

All of these records are on the UD02 table… and we pull them up based on their key values.

What we did for this form was to actually populate each of my (5) grids by BAQ/DataViews. Each grid has its own BAQ which only returns rows from UD02 with the proper keys.

But, because they’re tied to their own dataview (bound in the grid model), each grid gets it own “plus button”.

~*~
So… longwinded set-up summary:

I have one dataview called UD02_View… this it tied directly to the UD02 table. But I never populate this table. Its only there for when I add a new record (I’ll explain later).

I then have (5) different BAQ/Dataviews, one for each of my (5) grids.

Because Part Entry performs the “switch” I described above… clicking the plus button on one grid results in calling event-next: GetNewMyDataView1… or GetNewMyDataView2

We then created events for each one. So, if the base GetNew event-next results in GetNewNFMSpecifications (the grid I pictured above)… I have an event called GetNewNFMSpecifications that then fires.

It gets a little muddy because of all the event switching going on… and unfortunately we have another layer of chaos here…

Like the base OnClick_ToolNew button, which calls the GetNew event while passing parameters… we did the same thing.

My GetNewNFMSpecifications event performs another Event_Next which calls up our “master GetaNewUD02 Event”. But we added our own set of parameters on the Event-Next action.

Below are the parameters being passed to my master GetaNewUD02 event if I click the plus button on my Specification Grid.

But… had I clicked the plus button on my Keywords grid… that results in passing different parameters to my “master GetaNewUD02” event:

Below is my actual GetaNew event:

I check to make sure the PartNum is valid, then perform the GetaNew rest call, this new row is created on my UD02_View dataview (it is the only row in that dataview). We set that new row as the current one (may or may not be necessary) and perform a row-update. This is where I use some of those parameters we created earlier…

I set Key1 to a value of “{Part.PartNum}”
I set Key2 to “{SysVariable.type}”
I set ShortChar19 to “{SysVariable.sourcetype}”
etc.

It THEN open up a slideout which contains additional entry fields tied to various UD02 columns for the user to input more information.

We then have a save event which performs a UD02Svc.Update call to save that new record to the UD02 table. At the end of the save event, I have another event that refreshes all my BAQs. They re-run, re-populate their respective dataviews, and the grids then update to show the new records.

I know this is… a LOT. But this was our successful path.

~*~

One last thought…

If, you go a BAQ route and you include a calculated column of max(UD02.Key3)… this would be returned to your dataview(s). I would make sure your calculated field converts that to an int as Keys are strings.

A simple Calculation action in your events (prior to saving the record) could then take your {Calculated_maxKey3} + 1 and set that value to your new UD02_Key3 row (may have to convert that back to string?).

When you save that record, your BAQs would re-run and that new value would become your new max.

Just a potential non-function way of doing it (not tested).

That is A LOT of work for doing what I want to do, however I think this might work for me. First off, great job on figuring all that out! That must have taken a long time.

If this is the way to go and it seems like it might be, I’m still a little disappointed using BAQs that will ping the db needlessly just so I can display records that are already there and to be able to utilize an add button on multiple grids. Also using this solution, I would need to create multiple BAQs which adds more elements to the solution instead of just delivering one screen.

I’m not logged in anymore, but I’ll access this next week and see what I can get done. Thanks a lot for this!

So this isn’t going to work for us at the moment. It seems, and maybe I’m wrong, but it seems tying the grids to BAQs, you need to create events to fire the BAQs. This is too much for the amount of customization that is required. We need a simple solution as the screen alone has about 300 UD fields and several grids that have their functionality. In the end, I may go back to this idea, but I got to find a simpler way and maybe functions are the way to go.
Can’t believe Epicor abandoned so much functionality.

Thank you for your help though.

So I ended up doing something similar to what you have but some minor differences. I would have liked to use the inherit GetNew on the BO but this seemed a little easier.

I disabled the GetNew on the UD02 dataview getting rid of the plus button all together.

I then added a button on each grid for the “Add New” functionality. I created an event for each button which are all the same except one thing and that is setting Key2.

I call the GetNewUD02 which creates a blank record and I set the Merge Behavior to merge because it was clearing the dataset when this method was called. This is another reason I abandoned the BO because it was clearing the entire dataset to add the record. It never did that in .NET. Not sure why it would start now…

The one difference of all three events is in the row-update event where I set Key2 to the unique identifier “COMP” or “HP” or “UME”

I then created a custom event to tie to the BO save so the user would just hit the save button as normal. Here I have a condition that if RowMod = “A” on any row then to call the UD02.Update. The target is set to the BO before update, which I may change to after depending on user testing. But you get the idea. I basically wanted to tie to the BO save to avoid an extra user click.

All three grids are bound to the UD02 dataview with the client filter set on the provider model of the grid.

When I click the add new button on any grid, the existing filtered records stay while a new record appears and allows you to modify the cells and then the user can click save.

Now the only thing left is to do the +1… I may end up forcing the user to enter this and validate on save…

1 Like