Recursive CTE BAQ

Hi

I’m trying to make a recursive CTE but I’m not sure how to get the CTE to reference itself (the UNION ALL statement and the code underneath that references to first block).

I’ve heard it’s possible to do in E10 but I can’t find any examples. Is it done differently in a BAQ?

Any help would be greatly appreciated!

Cheers

F1 (Help) in the baq screen has a very thorough example of how to do this and generate a multi level bom

2 Likes

Apologies I’ve looked through the help files but I can’t find an example that helps me with this problem. I’ve been looking through:

Epicor ERP User Guides > Tools User Guide > Business Activity Queries section

Am I looking in the right place?

1 Like

It’s in the Epicor Help F1 (File -> Help)

You could try the search word indented…
The list returned should include a few threads that discuss the indenting of BOMs which might get you started.
e.g. here is one link:

2 Likes

Thanks! I’ve followed the instructions but I’m getting a syntax error with the indent columns, the help files say to add this code:

cast ( substring(’…’,1 ,(Hierarchy + 1) ) + PartMtl.MtlPartNum as nvarchar(25))

But it says Incorrect syntax near ‘…’. Is the ‘…’ supposed to be an expression?

The ‘…’ creates the indented look, that is needed.

Do you have the Hierarchy column created?

1 Like

I do have the Hierarchy column created

Are the apostrophe’s the “straight” kind or the smart kind?

1 Like

Would you be able to copy and paste the query phrase. That will help us see where the issue might be.