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)

Put a filter on data from a view

(0) ShareShare
ReportReport
Posted on by

Hi Guys

Might be a silly question, but i will ask anyway. :-)

I am modifying the form SalesPriceActual such the history of a customers purchases can be viewed on a new tabpage. To grab the data i have created a view, picking up data from Custinvoicetrans, joining Custinvoicejour to get the header information.

A have a grid on the new tabpage, datasource= the view i created.

What I am desperately trying to achieve is to filter the view such it only shows invoicelines from the customer I am on on tab one (overview).

I have looked on the net, but have not been able to find anything covering my requirement. 

Any help and/or hints will be much appreciated.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Can you explain your problem, please? In general, you can filter views in the same way as tables.

  • Community Member Profile Picture
    on at

    Hi Martin

    I will get back shortly.

  • Community Member Profile Picture
    on at

    OK, I will try.

    A form with two tabpages.

    First show a list of all customers. (just first to last, no filter, no nothing)

    Second show all CustInvoiceTrans. The datasource is a View, joining CustInvoiceTrans and CustInvoiceJour on the Invoiceaccount field. Activating the tabpage shows all records from all customers.

    I want to ONLY show CustInvoicetrans records from the customer that was active when i clicked the second tabpage.

    What code am I to add where (what method)?

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Aha, you expect to filter automatically, but you don't have any relation. You have to explicitly add a link or dynalink.

    What kind of join or link do you between your datasources?

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    I think if @palle adds one more table CustInvoiceJour inside form, it can be achieved without making any relationships. Because CustInvoiceTrans  already has relationship to CustInvoiceJour. Further CustInvoiceJour has relationship with CustTable.

  • Community Member Profile Picture
    on at

    Thanks for answer. The two tables CustInvoiceJour and CustInvoiceTrans is already in the list of datasources.

    When the second tabpage is activated, i need it to only show (filter) the invoices issued to the customer i am standing on in tab 1.

  • Community Member Profile Picture
    on at

    Hi Martin

    Thanks for answer.

    I am a complete autodidact (self-trained) developer. Any chance you could guide me in more details?

    How to set a link? Anything to put in the filter method?

  • Verified answer
    Community Member Profile Picture
    on at

    *SOLVED*

    This line in method "enter" on the tabpage:

       Datasource_ds.filter( fieldnum(datasource,invoiceaccount),CusttableDS.AccountNum);

  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    You didn't answer my question, but your code suggests that you use a kind of link (such as Delayed), therefore the right solution would be to add a dynalink.

    Please look at Adding a view as a secondary datasource on a form, where we discussed adding a link, and replace addLink() with addDynalink().

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