Application Error after changing order of one display field in BAQ

I made a simple change to a BAQ in E9 - I reordered the display fields so a certain field was moved to be the first column displayed. After I did this I tried to test the BAQ but this error immediately popped up in a dialog box:

Application Error
Length cannot be less than zero.
Parameter name: length

There is a dashboard that uses this BAQ - it seems to be unaffected by this. I am also able to access the results of the BAQ without issue through the API and can see that the column order was correctly changed. But I am dead in the water trying to do anything in the BAQ Designer, because this error keeps popping up multiple times. I have even gone so far as to completely exit out of Epicor and restart, as well as to clear the client cache, with no luck.

What is going on here and how can I fix it?

If you copy the BAQ, does the error still happen? It seems like something changed where the field is blank and is throwing the error now.

I get the same error if I try to copy the BAQ. It does copy the BAQ, but the resulting BAQ also has the same error.

I also tried removing all the displayed fields - still the same error. I’m not sure the error is actually tightly coupled to what I am doing. For instance, if I hit “analyze” I get the error pop up twice (and no analysis), but then I get the error popping up a third time after a short delay which is long enough that I can actually switch to a different tab before it pops up.

You could try reconnecting all the table links in the Designer. Do you have any calculated fields?

Yes, unfortunately it is a pretty complicated query - 5 calculated fields, 12 tables involved. I’ll try reconnecting the table links one at a time and see what happens…

I looked at a backed up version of the same query and am comparing the query phrase, and it appears that the simple act of moving a displayed field somehow really messed things up. The main thing is that there are now several “where” clauses that appear back to back instead of with the appropriate table they belong to.

At this point I’m thinking the best course of action is just to export the BAQ from the working environment and then import it back into the test environment.

Try importing it and see if you can duplicate the issue. I don’t see why moving a column would add where clauses.

That would be nice if you click Details button in the dialog box and provide full text of the error.

I work with Michael, and I’m seeing this same error. I believe it is the same BAQ… All I did was change the author and add a sort to the display. After removing the sort it still has the same error, nothing else changed. Any suggestions?

For future reference, it looks like in version 9.05.605 when saving a BAQ it occasionally gets corrupted. Specifically we found several parameters that weren’t touched had been cleared out, after fixing those the same error persisted. We ended up deleting the corrupted BAQ and copying something similar and recreating it. We have backups but it was less work to go this route.

Lesson learned export BAQs before making any changes so I have a quick way to revert. Also, I’m looking forward of moving to E10 as ideally we don’t have to worry about strange corruption of BAQs.

Did you check to see if it was an updateable BAQ?