You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently we ran into an issue caused by us not having passed in enough arguments to a Select. It took a while to find, as Acuminator wasn't showing a warning in this specific use case.
We'd originally had a series of conditions, but we'd broken one off and put it in a WhereAnd applied under a certain circumstance. However, we forgot to remove the condition from the original Select declaration. We found that specifically when WhereAnd is involved, Acuminator may not show the warning.
Here is some sample code that can be added to any graph referencing PX.Objects.AP. We also found that it's both parts of the if/else that Acumatica doesn't show the warning.
//Test to see if it was the if/else that was causing the problem.protectedvirtualvoid__(Events.RowInserting<APInvoice>e){if(e.Row!=null){PXSelectBase<APTran>cmd=newPXSelectReadonly<APTran,Where<APTran.tranType,Equal<Required<APTran.tranType>>,And<APTran.refNbr,Equal<Required<APTran.refNbr>>,And<APTran.lineNbr,Equal<Required<APTran.lineNbr>>>>>>(Base);boolb=false;if(b){}else{//Warning shows just finecmd.Select(e.Row.DocType,e.Row.RefNbr);}}}protectedvirtualvoid__(Events.RowSelecting<APInvoice>e){if(e.Row!=null){PXSelectBase<APTran>cmd=newPXSelectReadonly<APTran,Where<APTran.tranType,Equal<Required<APTran.tranType>>,And<APTran.refNbr,Equal<Required<APTran.refNbr>>,//Accidentally left this And here when WhereAnd was written.And<APTran.lineNbr,Equal<Required<APTran.lineNbr>>>>>>(Base);using(newPXConnectionScope()){boolb=false;//Warning doesn't show in either case.if(b){cmd.WhereAnd<Where<APTran.lineNbr,Equal<Required<APTran.lineNbr>>>>();//Wrong number of arguments passed to see if it was only in the else that Acuminator didn't show the warning.cmd.Select(e.Row,e.Row.DocType);}else{cmd.Select(e.Row.DocType,e.Row.RefNbr);}}}}
The text was updated successfully, but these errors were encountered:
Hi @ShadowFiendZX . I think it is a bug when there is no warning in the else block in your example. But the rest is an expected behavior, including not showing warning in the if block.
The current implementation detects calls to these methods, but it doesn't calculate corrections from them. Instead it just stops the check so no error would be produced. If you modify BQL dynamically then the query is not checked.
It's not impossible to calculate the number of parameters in some cases but it is impossible to do this in general.
For example, what if you have a code like this:
You can find similar example for a generic WhereAnd method.
It is possible to try to distinguish such cases but I'm afraid we won't implement such analysis or do it in the distant future. It should be a complex analysis that will require a lot of time to implement. At the same time this case is really rare. Almost all BQLs don't use BQL modifying methods. In fact, many of them are static.
Recently we ran into an issue caused by us not having passed in enough arguments to a Select. It took a while to find, as Acuminator wasn't showing a warning in this specific use case.
We'd originally had a series of conditions, but we'd broken one off and put it in a WhereAnd applied under a certain circumstance. However, we forgot to remove the condition from the original Select declaration. We found that specifically when WhereAnd is involved, Acuminator may not show the warning.
Here is some sample code that can be added to any graph referencing PX.Objects.AP. We also found that it's both parts of the if/else that Acumatica doesn't show the warning.
The text was updated successfully, but these errors were encountered: