web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Filter a grid for not null values

(0) ShareShare
ReportReport
Posted on by 680

Hi,

I have a form with a grid. The grid is displaying columns from two data sources. The data sources are joined in an outer join resulting in values from the second table can be displayed empty (null).
Now for the tricky part. When a user filters the grid (advanced filter) and enters a criteria that a field from the second data source must be a specific value AX returns those values matching the criteria AND all null values. I dont want it to display the null values (they are not actually matching the criteria, right?)!
How do I achieve this? I have tried writing SQL statements as critera, (FieldName != "") and (FieldName != NULL) etc, but no success. 

Thanks in advance,
Olof

*This post is locked for comments

I have the same question (0)
  • Ragin Patel Profile Picture
    990 on at

    I was just thinking about changing join type to inner join in filter method. And reset to outer join when user removes the filter. Is it going to help you?

    -Ragin

  • Olof Wallin Profile Picture
    680 on at

    Hi Ragin,

    thank you for your reply. I am actually not sure how to achieve this. Can I override a method on the FormDataSource when filter is applied? I tried to override the method called 'filter' but it doesnt seemed to get called upon when applying filter.

    Regards,
    Olof

  • Ragin Patel Profile Picture
    990 on at

    You may trace filter method on Field level of data source.

  • Olof Wallin Profile Picture
    680 on at

    I bumped into my own question when googling this a second time. I dont remember the solution in the previous case. However, this time I solved it kind of how you describe it. I was not able to put code in the overriden filter method on the field. The code would never run, dont know why. Instead I put code in the master table´s executeQuery method. I checked for QueryBuildRange-objects on the sub table, and if I found any and they contained filter (!"") I changed the join mode to inner join. Otherwise I left it at outer join.

  • Andrew Price Profile Picture
    5 on at

    use !""

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans