Hi all,
i have a problem with the filter functionality in AX (4.0). I wrote the following code:
Query qry; QueryBuildDataSource qbds; QueryBuildRange qbr; ; super(); qry = MyTable_ds.queryRun().query(); qbds = SysQuery::findOrCreateDataSource(qry, tableNum(MyTable)); qbr = qbds.addRange(fieldnum(MyTable, My_Field)); qbr.value('!0');
wich is executed if a specific CheckBox is set. It works as excepted.
But if i enter a new filter value into My_Field, the "!0" filter criteria is copied to another (NOT A SPECIFIC!) column. And this only happens, if there are columns before My_field, which are currently out of scope (not in the visible range).
Is this a bug or am i missing somesthing?
Thanks in advance,
Frank
*This post is locked for comments
Ok.
Thank you for your help :)
Frank
Seriously, if the problem is in Filter by Grid, Microsoft is probably the only one who can help you. Check also if there is no hotfix for this problem.
Hi,
>So you add a range by button (Beware! Your code adds a new range every time, it doesn't update existing ranges.)
You are right, i know, but this only was a "test" button.
>if you overwrite the range value using the Filter by Grid feature, the original filter applies to another field, right?
Yes
>Could you show the query after if fails?
SELECT *
FROM MyTable1
WHERE ((NOT (ColumnC = 0))) AND ((ColumnA = 1.5E1))
JOIN * FROM MyTable2
WHERE MyTable1.FK_XXX = MyTable2.PK_XXX AND ((Prov_LockStateBool = 0))
--> ColumnA = 1.5E1: Overwritten filter criteria (i entered 15 into the filter)
--> ((NOT (ColumnC = 0))): This is (why ever) the automatically added filter...
Frank
So you add a range by button (Beware! Your code adds a new range every time, it doesn't update existing ranges.) and if you overwrite the range value using the Filter by Grid feature, the original filter applies to another field, right?
Could you show the query after if fails?
Anyway, if you believe there is a problem in Filter by Grid, you should ask Microsoft for support.
Hi
>'m not sure what ColumnA is. Is this describing the situation when you would expect (NOT (My_Field = 0))?
the source in my first post results in the select-statement in my second post. I got this with your suggested qbds.toString() statement. columnA is filterd with "!0".
columnA is a column of type "real", columnB is a column with an Enum Type.
>Where do you enter the filter value?
Everything is working correct - until i press Ctrl+G (activate Filter) AND overwrite the "!0"-filter criteria in the grid. Realy strange is, that this "problem" only came up, if there are columns BEFORE columnA (containing "!0"...) wich are not visible - if i move columnA to the left, so it is one of the first columns, the problem does not appear...
>Is the value copied in the grid or only when applying filter?
The value is copied if i change the filter manually - pressing Ctrl+G and then overwrite the "!0"-filter criteria...
>It the code correct?
I hope so :). The form contains 2 DataSources (inner join) and a Grid and the button with the source from my first post...
I removed all other source to avoid other problems/sideffects.
Frank
I'm not sure what ColumnA is. Is this describing the situation when you would expect (NOT (My_Field = 0))?
You say: "But if i enter a new filter value into My_Field, the "!0" filter criteria is copied to another (NOT A SPECIFIC!) column. And this only happens, if there are columns before My_field, which are currently out of scope (not in the visible range)."
Where do you enter the filter value?
Using Advanced Filter/Sort? Is the value copied in the grid or only when applying filter?
Or do you have your own form control for that and the range is added in code? It the code correct?
The SQL query looks like this:
SELECT * FROM MyTable1 WHERE ((NOT (ColumnA = 0))) JOIN * FROM MyTable2 WHERE MyTable1.FK_XXX = MyTable2.PK_XXX AND ((ColumnB = 0))
Frank
How does the SQL query look like in the case described? You can get it by qbds.toString().
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,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156