Filter data in Grid

Hi all,

I am using Microsoft Dynamics AX 4.0 and what i would like to do is to filter the records shown in a Grid on my Form. The data shown in the Grid is from the table SalesParmTable. It displays fields ParmId, TransDate and DlvMode.

I only want the records where Ordering = 'Picking list' and   SalesId = the SalesId that is selected by the user.

I have tried to write a query (in the textChange method of the field where the user selects the SalesId) to set as the datasource of the grid but i couldn't get it to work.

I am quite the beginner when it comes to programming in X++ so describing every step would be much appreciated.

Thanks in advance
-M3mph15
LVL 6
M3mph15Asked:
Who is Participating?
 
quale-kaizenCommented:
Try to override the modified method of the salesId field on the form.
This code assumes you the name of your datasource is 'salesParmTable'.
public boolean modified()
{
    boolean ret;
 
    ret = super();
 
    if(ret)
    {
        salesParmTable_ds.filter(fieldNum(salesParmTable, SalesId), this.text());
    }
    return ret;
}

Open in new window

0
 
quale-kaizenCommented:
Do you use the salesEditLine form, or a custom one?
0
 
M3mph15Author Commented:
Thankyou quale-kaizen. Your solution worked perfectly.
0
 
M3mph15Author Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.