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 Microsoft Employee

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

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: Put a filter on data from a view

    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().

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Put a filter on data from a view

    *SOLVED*

    This line in method "enter" on the tabpage:

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Put a filter on data from a view

    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?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Put a filter on data from a view

    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.

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,614 User Group Leader on at
    RE: Put a filter on data from a view

    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.

  • Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: Put a filter on data from a view

    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?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Put a filter on data from a view

    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)?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Put a filter on data from a view

    Hi Martin

    I will get back shortly.

  • Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: Put a filter on data from a view

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

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans