Hello and happy Friday.
I have an AOT query I'm calling from within X++ code. On the AOT query, one of the datasource I have a range defined for a specific created date values (I'm currently using greaterThanDate(-90) in the AOT query for testing). At runtime, is it possible to modify the created date range value, say to greaterThanDate(-1), from within X++ before executing the query itself? Hope that was somewhat clear.
Thank you!
*This post is locked for comments
Try This IT works fine:
qbrDate = SysQuery::findOrCreateRange(query.datasourceTable(tableNum(WHSWorkTable)),fieldNum(WHSWorkTable,WorkClosedUTCDateTime));
qbrDate.value(SysQuery::range(fromDate, todate));
if your question isn't related to the topic of this thread ("Modify range in AOT query"), please create a new one.
Well, I'm trying to incorporate the union part programmatically to a query in which I have 2 tables already joint.
but it doesn't seem to work. When I run SQL profiler the query doesnt take into consideration the union piece.
Do you have any examples for union with complex queries laying around somewhere?. :-)
Thanks.
Everything what you can do with the Query framework can be done even if you create the instance of your Query object from an AOT query.
Hello,
Along the lines of the same question, but totally different :-)
Can I modified a query who already joins 2 tables and add a 3rd datasource but as a union all?
Thanks.
Regarding the new question - yes, you can do whatever you want with such a query.
For example, find an existing data source (e.g. q.dataSource(tableNumTable(YourTable))), add a range (addRange(fieldNum(YourTable), YourField))) and so on. You'll find many examples both in AX and on internet.
Not a problem. Find the range by QueryBuildDataSource.findRange() and change its value (QueryBuildRange.value()).
Brandt, thanks for the reply but I'm not sure the question was answered. My dilemma is I have an AOT query, not one that I built in code. The AOT query contains a value in the range node which I would like to change at runtime.
Better yet, I could phrase the question a little differently. Is it possible to add a range to an AOT query called within X++ code? So this is all I have to access the AOT query from within X++...
Query q;
q = new Query(queryStr([AOT query name]));
Once I have "q", can I modify the query details?
Thanks!
I would take a look at the SysQueryRangeUtil class:
msdn.microsoft.com/.../sysqueryrangeutil.aspx
Specifically the dayRange method.
Hope that helps.
Brandt
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156