Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Add a filter field to an in memory source table grid

Posted on by 105

I added a field to the smmActivitites table. I am searching for a way to use that field to filter the grid in the ProjBudgetRevision form which uses the TmpProjBudgetRevisionLine witch it happens to be a InMemory table type.

I have tried adding the field to the TmpProjBudgetRevisionLine table and populate the field using the onInserting event handler of the table, but the event never gets hit. I have also tried the onValidateWrite event which gets hit only when inserting new rows from the grid, but not when the table gets populated when initializing the form, and event when the event gets hit I am no able to update the field from there.

For now I have added the field with a display method, but as I said I need to filter the grid using that field witch I can not do!

Any Ideas?

Thanks in advance for your help.

 

 

  • Emilio Molina Profile Picture
    Emilio Molina 105 on at
    RE: Add a filter field to an in memory source table grid

    Thanks for pointing me in the right direction. After reviewing the code I found what was wrong and get it to work!

  • Emilio Molina Profile Picture
    Emilio Molina 105 on at
    RE: Add a filter field to an in memory source table grid

    This is what I am doing in the post event handler of the ProjBudgetRevisionManager_Post_getRevisionCostLines. I don't see why this would not work. I guess there is something about inmemory tables I don't know.

    Any suggestions or comments will be much appreciated.

    [PostHandlerFor(classStr(ProjBudgetRevisionManager), staticMethodStr(ProjBudgetRevisionManager, getRevisionCostLines))]

       public static void ProjBudgetRevisionManager_Post_getRevisionCostLines(XppPrePostArgs args)

       {

           TmpProjBudgetRevisionLine   tmpRevLine =args.getReturnvalue() as TmpProjBudgetRevisionLine;

           ProjBudgetRevisionLine      projBudgetRevisionLine;

           ProjBudgetRevisionManagerActionType _action=  args.getArg(identifierStr(_action));

           RecId _projBudget=  args.getArg(identifierStr(_projBudget)) ;

           RecId _projBudgetRevision=   args.getArg(identifierStr(_projBudgetRevision)) ;

           update_recordset tmpRevLine

                       setting ISProjWBSEquivalente      = "VALUE"

                       join projBudgetRevisionLine

                       where

                               projBudgetRevisionLine.ProjBudgetLine     == tmpRevLine.ProjBudgetLine &&

                               projBudgetRevisionLine.ProjBudgetRevision == _projBudgetRevision;

           Args.setReturnValue(tmpRevLine);

       }

  • Verified answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Add a filter field to an in memory source table grid

    Hi Emilio Molina!

    I mean what in this class you can find methods which populate data to TmpProjBudgetRevisionLine table and you can extend this class and write some logic.

  • Emilio Molina Profile Picture
    Emilio Molina 105 on at
    RE: Add a filter field to an in memory source table grid

    Hi Rustem Galiamov. Thanks a lot for your time. I reviewed the getRevisionRevenueLines method on the ProjBudgetRevisionManager class as you suggested. I'd tried extending the post event handler and making an update_recordset of the tmpRevLine, but even it doesn’t throw any error the table does not get updated!

    What is what you have in mind?

    Thanks a lot for your help.

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Add a filter field to an in memory source table grid

    Hi Emilio Molina!

    Take a look at init() method on projBudgetRevLineRevenueTmp DS of the form. Then to the getRevisionRevenueLines() method on ProjBudgetRevisionManager class.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,995 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,610 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans