BAQ calculated fields available for other queries

I created a few calculated fields for one of my queries and would like to use these same fields in new/other queries. How do I do this without duplicating my efforts?
Thank you in advance!

Until this one is done

https://epicor-manufacturing.ideas.aha.io/ideas/ERP-I-158

(Baq source for other BAQ’s)

You will have to copy paste. It sucks…

1 Like

I tried to copy/paste, but once I ‘left’ the copy query, I was not able to paste into the target query. Any tips?

I usually open up 2 BAQ windows. You can Shift click the menu item, and will open a second window so you can have them side by side. The calculated field menu is modal, so you will have to get in and out of that window (or open up 2 completely different instances of epicor :smiling_imp: ).

Also, I turn on the windows+V feature so that I can have more than one thing at a time in my clipboard. It helps for stuff like that.

A final note to keep in mind is that you might have to change the table name if you have aliases set up on the tables. This happens when you have the same table 2 or more times in the same query. That little window that pops up that asks you to make a new name for it. So check your syntax on every field as you make it so you know when an error occurs so you don’t have so much stuff to go picking through.

And this should work… It’s just text.

1 Like

I will walk through your recommendations and see how it goes. Thank you!

I was able to open 2 BAQ windows in the same plant by using Shift+Click. So, they are side-by-side.

I go to Window 1, pull up the Calculated Field SQL Editor.
I click on the calculated field, go to Edit and select copy (Ctrl+V)
I close out of the Editor

I go to Window2, pull up the Calculated Field SQL Editor
Go to Edit and paste - no luck
Go to New and paste - no luck

I’m not sure I understand your last paragraph. Perhaps because I’m so new I’ve never changed a table name. I didn’t think that was possible.

Love the tip for Windows+V clipboard!

Here’s what I’m talking about with aliases. If you bring in the same table twice, you need a second name so that it knows which x table it is.

aliases

This is how you copy paste. It’s literally just pasting the text, so not fancy. (and this one would actually fail, because I don’t have the correct tables in there, but you should get the point)

copyPaste

The copy paste is really just a half a step better than manually retyping.

1 Like

One other method for this is to use Executive Queries and store you calculated value in a field in the SysCube table. Then you can pull it later into another BAQ. This might be more trouble than it is worth, depending on your use case.

Hey @NateS , I’ve never been able to figure out how Executive Queries work. Would you be willing to record and post a video that explains how you make those? (Probably in a new post).

1 Like

Good Idea! I will see what I can put together. I’ll link it here when it’s done.

Using Executive Queries to Store Calculated Values from a BAQ - Kinetic 202X - Epicor User Help Forum (epiusers.help)

We use executive queries and it works pretty well for our purposes. In our case we are storing a job weight calculation which is a very intensive calculation that we don’t want to repeat in so many different reports/dashboards. BUT I will say there is one major flaw - you can’t do an upsert. Trolling for votes: https://epicor-manufacturing.ideas.aha.io/ideas/KNTC-I-2824

Got it! I’ve never duplicated a table and not sure where that comes in handy. I’ll bookmark this post for the future.

Ahhh! I was trying to copy/paste everything, not just the Editor.

I really appreciate you sharing this knowledge via videos. I’m a visual learner and this helps a lot.

Usually this happens when you have subqueries. It’s common to have subqueries that are close but for some reason different, but you bring in a lot of the same tables.

I figured it was something like that, which is why I did the video.

Well (:safe_harbor: Safe Harbor statement :safe_harbor: )
I just saw the demonstration of the new BAQ as a source for another BAQ story/idea mentioned above. IT WORKS… and works well…
Then I was building my own sample version, and tested it… IT WORKED, and it worked well, and easy.

  1. I created a BAQ that goes to calculate the unit cost for a part. This takes multiple tables. (Part, PartPlant, Plant, & PartCost)… each to retrieve necessary values to find the correct part cost (Plant to get the correct PlantCostID to get the correct PartCost record for the linked PartPlant)

  2. Now that i have that “source” table, i am creating a second BAQ that will USE that baq… This BAQ uses the Part, PlantWhse (to get the plant that the warehouse belongs to), the PartWhse (to get the QTY On Hand), and then my lower level BAQ.

The result of this is that I can reuse my source BAQ many times in multiple queries.

BUT to get this new an exciting feature, you will need to upgrade to 2023.2, AND use the new BAQ Editor in the Browser (not available in the smart client).

(:safe_harbor: Safe Harbor Statement :safe_harbor: )

1 Like

What happens if you open that in classic?

Hmm… not sure :safe_harbor: