Can you figure out if a system BAQ was used for an epiUltraGrid?

Hello,

I keep getting requests to add a column to grids and I was looking for a better way to recreate the original in order to replace with a BAQView I create (or copy and modify).

Is there some way to backtrack if an epiUltraGrid that come in Epicor was created from a system BAQ?

An example one that they keep pushing on me is: Method Tracker->Material->List grid.

I have looked into trying to recreate the grid manually but there are multiple columns that I am unsure of the mapping.

Any answers are welcome and appreciated. Also, any links to answers or tutorials on recreating system grids…

Thanks,

Shawn

Not sure it’s what your looking for but I figured I’d share:

1 Like

Hey @Chris_Conn,

That was the start of my journey down the rabbit hole of recreating the grid with a BAQ and then replacing the grid’s contents with my BAQ. It worked great with a little help from @josecgomez.

My problem is that there are grids that I am not sure what all the mappings were. If they are based on system BAQs created by Epicor, then how would I backtrack from the grid to see what BAQ they were using.

If I can find that, I can copy and modify it, then substitute my new BAQ for their BAQ.

Thanks for linking that topic though, it can help other people in my boat.

Shawn

Open the form in Customization - click the grid and look at the EpiBinding field.

In the case of the material list it points to ECOMtl which is a DataView on the form.

You can view the DataView’s by clicking

Tools > Object Explorer then
Custom Object Explorer > Data Objects > then open the desired item on the tree

In this case that grid isn’t driven by a baq but foreign key views against a DataView. Essentially, you can keep what’s there and add your own FKV against the dataView to link it to a specific table\field.

1 Like

I vaguely understand what you are saying but am not sure of the execution.

Let me explain specifically what they want added to the grid and if you can give me some pointers, it would be appreciated.

In the grid, they would like to add 2 UD fields from the Part_UD table. How would I go about doing that with FKV?

I haven’t forgot about you, I’ve just had my own brain buster I’ve been chugging along at.

Lol, no problem. I have been poking but it really isn’t making any sense to me yet.

Thanks for letting me know. I appreciate it.

No wonder you were confused. Apparently I was too. You cant link FKVs in a single grid despite what I thought.

The easiest way is to make a BAQ - then use Jose’s video on calling BAQ from code with parameters.

I’ve attached a BAQ linked to Part - just add your custom Part fields.

There are 2 params to supply - Part and Revision which will be available from your form.
PartMtl.baq (22.3 KB)

Then you’ll set the Datasource of the grid the result of this baq.

1 Like

When somebody just wants one extra column in a system grid, rather the rebuild the wheel, we programmatically add a column to the EpiUltraGrid and populate the cells manually through a loop.

This keeps it simple especially if the data exists in a view in the form already.

Hey @Ben_Bowtell,

I would be interested in learning that technique. Would you happen to have a link to a tutorial on that.

I have tried to piece it together before but abandoned it when I found Jose say that it was inefficient to do it that way.

Any help you can give would be appreciated by me and everyone that comes after.

Thanks,

Shawn

Hey @Chris_Conn,

Thank you for creating the PartMtl baq. I will try to put it to good use.

You are the man!

Thanks,

Shawn

I’ve got some snippets of code I saved so I had a good starting place for next time.

To manipulate the EpiUltraGrid you need to pull in the right namespace:

using Infragistics.Win.UltraWinGrid;

Then you need to reference the datagrid, check if the column exists already and add it if not. In this instance I did it in an EpiViewNotification event.

var invoices = (EpiUltraGrid)this.csm.GetNativeControlReference("4a48831d-5d15-4e2c-9b2e-77c7e48ed6bb");

UltraGridBand gridLayout = invoices.DisplayLayout.Bands[0];

if(!gridLayout.Columns.Exists("DebitMemoRef"))
{
	gridLayout.Columns.Add("DebitMemoRef","DebitMemoRef.");
}

Once the column is in I then looped throw the rows and updated the value for each:

foreach (UltraGridRow row in invoices.Rows)
{
    // get the key from the datagrid
    int rmaNum = (int?)row.Cells["RMANum"].Value ?? 0;
    // do some lookup using RMANum and set the new column value
    row.Cells["DebitMemoRef"].Value = "some value";
}

Hopefully that helps?

It can be depending on what you are doing. If you are doing DB lookups (Business Object, BAQ, or anything like that) yes it is very inefficient.
But if its simple calculations that may be ok

Just for context, the example I posted above was in the Customer Credit Manager screen. On a change of customer I would execute a BAQ and pull in a list of RMA numbers/debit note references (or some field like that, I forget) and store the results.

When the InvoiceHead view was updated I would then add a column to the Invoice datagrid and lookup the debit note reference from the stored BAQ results to populate the row using the RMA number as a key.

1 Like

Many ways to skin a cat, in this case here is what I recommend, sorry I’ve mostly ignored this thread been busy, but I had a few minutes to look this morning.
You want to get some UD fields from Part into ECOMtl view ( and potentially PartMtl) that’s pretty easy and it is actually built in to the system
Step 1: Create UD Fields in Part_UD which you’ve already done
Step 2: Create the same UD fields in ECOMtl_UD and PartMtl_UD (same name is recommended but not necesary)
Step 3: Use Extended UD Table Field Map to map over the data from Part_UD to ECOMtl_UD



image

And just like that it will automatically copy those fields to ECOMtl from Part
Step 3: Can then be repeated from EcoMTl to PartMtl if you want to store them in that table. The _UD fields added to the ECOMtl table automatically show up in the Method Tracker Material List View.

Zero code needed :slight_smile: in this case

Hope this helps

3 Likes

Now that I am learning a new feature. How do I get the Target Columns to appear? I have a bunch of Map ID but no Columns to select.

1 Like

Did you create the UD columns in Both sides? Re-Gen Data Model -> Recycle App Server?

I see what I didn’t do, yes now they are there. Thanks for the reminder.

How do I add new table mappings?

Hey @josecgomez,

I followed your steps:
I had the Part_UD fields already created.
I created the same name fields in ECOMtl.
I did a regen and recycle app pool to enable new UD fields.
I then opened ‘Extended Field Map Maintenance’
Selected Map ID 6 (Source: Part, Target: ECOMtl)
Filled in Description and clicked the ‘Enabled’ checkbox.
Mapped the 2 fields to the corresponding tables same named columns.


Saved and exited Epicor.
Went back in and looked at the Method Tracker: Materials -> List tab and the UD fields were not listed.
I even opened Tools->Optimization and made sure the fields were not hidden in there.

Is there something I missed?

Probably have to update the fields on Part again so the field map populates. We had a similar issue with Demand & Order tables.

Try a test part and set the UD to a different value, save, then set it back. Then see if the field got copied to the other table.