I would like to submit a very dynamic query using QueryServices. The problem is: the query text is going to be written by the developers, so I won’t know its structure beforehand (that is, without constructing a custom parser myself).
For instance, the developer would write “SELECT FROM (something) JOIN (another table) WHERE (some conditions)” and pass this string to a class which would then communicate with AX. I guess that makes using static queries from AOT and even dynamic queries impossible.
Is it feasible? If not, using .NET BusinessConnector would not be a problem if it allows this to be done.
Thank you all in advance.
There is no solution that would do exactly what you want, except using X++ (or T-SQL). Even in Business Connector you have to pass a table name to createAxaptaRecord() method, therefore you would have to parse the query string first. Consider LINQ to AX, if possible.
If developers must be able to use any X++ query, they should be using X++ and AX IDE.
You could let developers write X++, send it to AX as a string, run it there and return results, but it has many disadvantages - developers would lose IDE support, compile-time checking, X++ debugger…
Linq to AX seems a good choice, although it would require some changes in our development environment because we use VS 2012.
Thank you for your reply, Martin. I really appreciate it.