Add UD Tables to Query Phrase in BAQ Designer

Sometimes I want a sanity check before I click Test or GetList in a BAQ so I copy the Query Phrase into SSMS and run it. Or I might modify it in SSMS add fields or other logic before I go back and change anything in the BAQ. Except when I paste it, I have to redo the joins on tables that have UD fields because obviously SQL Server knows that the UD fields are not in the same parent table as Query Phrase suggest.

Sure it might clean up the phrase but I’d rather have valid SQL that I can use.

All you need to do is change the ERP.XXX to DBO.XXX in your SQL Phrase.

FROM ERP.OrderHed

Change it to

FROM DBO.OrderHed
4 Likes

Well that’s a handy trick! Thanks! Where did you learn this from?

For every UD table you add Epicor creates a view in the DBO schema which is a join of the two tables with the same name :slight_smile: that’s how the “magic” happens and how come you don’t have to have 2 tables referenced everywhere.
#LookingUnderTheHood

That’s crazy magic. Now you got me curious (and distracted) :grinning: