Report data source range

Hi Guys,

I have an AX report

Data Sources: SELECT FIRSTFAST * FROM Table1 NOTEXISTS JOIN FIRSTFAST * FROM Table2 WHERE Table1.Field1 == Table2.Field1

I’ve added a Range under Table2: Table2.Field2

What’s happening to my report is that, it works pretty fine when I’ve put values on my range (Table2.Field2), but when I don’t put any values on it, it says, “Report is empty”, which shouldn’t be the case. I know I’m missing something here, but what I would like to happen is that when I don’t put any values on the range (Table2.Field2), it will just list all records (like disregarding/disabling the filter)

What should I do? :frowning:

Appreciate all the help.

Thank you so very much! :slight_smile:

Hi,

If you don’t put any value to the range, a subquery (not exsist) will return all the records from a table “Table2”. So if every record in table “Table1” has got corresponding record in a table “Table2”, the query won’t return any records.

Regards,

arnam

Oh… I see… Well, that explains it… Thank you very much Arnam… :slight_smile:

Not at all :slight_smile:

…please mark topic as resolved :slight_smile:

Regards,

arnam

Hi again Arnam,

I fully understood now what you’ve told me about the subquery (not exists) part of my data source, thanks again for that one. I hope it’s not too much to ask, my apologies, but what approach you think I should do in order to still fulfill both the option to exclude some data using my range (Table2.Field2), and at the same time, be able to list all data if I don’t put any values to the range.

Thank you so much. I really appreciate all the help. Thank you… :slight_smile:

Hi,

You can check query().dataSourceName("Table2 ").RagneCount(). If count is equal zero (no ranges were added) then you can remove this dataSource or just disconnect it from master dataSource (“Table1”).

Another way is to add a range condition that will never be satisfied ex. Table2.RecId == -1.

In the first case you have to do it from the code. In the second you can do it from GUI level or from the code.

Regards,

arnam

Think I got it now. Thank you so much Arnam. You’ve been of great help. Thanks again. Till next… :slight_smile: