Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How to remove added datasource from a query by code

(0) ShareShare
ReportReport
Posted on by 1,550

Hi,

If let's say i have a code that says

QueryBuildDataSource = query.AddDatasource(...)

And i want to remove this datasource from the query based on a condition..how can i do it by code?

I can't find a method related to clearing datasource from a query

  • Suggested answer
    Hana Xue Profile Picture
    Hana Xue Microsoft Employee on at
    RE: How to remove added datasource from a query by code

    Hi,

    Supplementary Note:

    In addition, related articles are found for you, you can refer to them. Hope these will  be useful as well!

    How can I delete a dataSource previously added? — mibuso.com

    axapta - Dynamics AX: Disable datasource from form in code while being able to use advanced filter/sort option - Stack Overflow

    Best Regards,

    Hana

    This post is my own opinion and does not necessarily reflect the opinion or view of my company.

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How to remove added datasource from a query by code

    Hi,

    You can also refer to the below thread.

    community.dynamics.com/.../remove-added-data-source-to-qbds

    Thanks,

    Girish S.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How to remove added datasource from a query by code

    Hi, Please check this old thread

    community.dynamics.com/.../498807

  • Suggested answer
    Anton Venter Profile Picture
    Anton Venter 19,493 Super User 2025 Season 1 on at
    RE: How to remove added datasource from a query by code

    Hi,

    You can use the enabled propery to disable it.

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…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,979 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,848 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans