Search code examples
formsaxaptadynamics-ax-2012

Form grid filters


I want store the filters entered on the grid, is it possible to store the filters entered on filter pane of the grid.

I want to use those filters entered in my class, please help me in this regard.


Solution

  • Yes you can retrieve the filters by getting the form's queryRun's query and packing that into a container to be stored/passed/unpacked.

    The form has a query, that is passed to QueryRun, then the users puts filters/dynamic joins/etc on that query that belongs to the QueryRun. So you need the modified query to store what you want from it.

    void clicked()
    {
        Query   q = salestable_ds.queryRun().query();
        int     i;
        container c;
    
    
        for (i = 1; i <= q.queryFilterCount(); i++)
        {
            info(strFmt("%1: %2", q.queryFilter(i).field(), q.queryFilter(i).value()));
        }   
    
        // If we want to store these we can do
        c = q.pack();
    }
    

    See this post http://dynamicsuser.net/forums/t/63208.aspx