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 :
Finance | Project Operations, Human Resources, ...
Answered

Is it possible to filter a table buffer?

(1) ShareShare
ReportReport
Posted on by 45

I have a table buffer that I get by calling a method on some object. The table buffer has some rows in it. The table is also a TempDb type.

Assume it has

ID COLOR
001 RED
002 BLUE
003 RED
004 GREEN





How can I filter out the rows where the COLOR is RED?

To achieve what I need I am currently looping the records and deleting what I don't need.

snippet:

FtsMtoTmp ftsMtoTmp = isvClass.GetFtsMtoTmp();


while select forupdate ftsMtoTmp
{                       
    if ftsMtoTmp.COLOR == "RED" )
    {
        ttsbegin;
        cmaCWSupply.delete();
        ttscommit;
    }            
}




Expected results:

ID

COLOR

002

BLUE
004 GREEN





For the sake of the question assume I can't ask the ISV to change their method GetFtsMtoTmp(). Is there a better preferred way to filter the table buffer than what I'm currently doing?

I have the same question (0)
  • Verified answer
    piyush004 Profile Picture
    110 on at

    Hi Anthony, 

    You can do it without using a loop. Depends on your requirement. Please refer the link.

    https://docs.microsoft.com/en-us/dynamicsax-2012/developer/delete-from

    Please mark all helpful answers as Verified.

    The information provided reflects in my personal view.  I hope it may help you or someone at some stage.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    301,053 Super User 2025 Season 2 on at

    Hi Anthony,

    The temporary table object is created and filled somewhere already. If you don't need records, try to avoid having them inserted in the temporary table. That would be my first recommendation here.

    You can also do a loop with a filter where you exclude "RED", like

    FtsMtoTmp ftsMtoTmp = isvClass.GetFtsMtoTmp();
    
    
    while select forupdate ftsMtoTmp
    where ftsMtoTmp.COLOR != "RED"
    {                       
        // to do: implement coding here            
    }

    Another approach would be parsing the temporary table object in a query object where you can also set ranges for which records to process.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    As others have mentioned, it's better to impact the data retrieval and only fetch the needed records from the database. Otherwise you are causing an unnecessary performance cost.

    But, if you want to "filter" something out of the buffer, you need to iterate it and pick the values that you want to pick.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 464 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans