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

  • Suggested answer
    Martin Dráb Profile Picture
    233,019 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
    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
    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
    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
    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
    233,019 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
    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
    on at
    RE: Put a filter on data from a view

    Hi Martin

    I will get back shortly.

  • Martin Dráb Profile Picture
    233,019 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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,283 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,019 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans