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, ...
Suggested Answer

How to filter the child form data on the basis of parent form available record value

(0) ShareShare
ReportReport
Posted on by

I have a parent form and i have added a action menu button which opens a child form 

i want to filter the child form data on the basis of parent form data.

in parent form i have a grid, having multiple rows and each rows having different voucher no, i want to use all the current form voucher no to filter the record on child form 

I have the same question (0)
  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    What exactly do you mean by "all the current form voucher no"? All records that meet the criteria of the query in the parent form? For example, if the table has 500 records, the query applies filters that are met by 100 records, 20 of them displayed on screen without scrolling, you want the child form to show data related to those 100 parent records?

  • Community Member Profile Picture
    on at

    i have different journals each journal have different no of records

    when i open any 1 journal i have multiple no of records in a grid of the journal and even i can create new records

    each record i.e row on a grid have different voucher no.

    and on the same form i have action menu button to generate child form .

    currently the child form display  all the data available on table.

    i want only those record should be displayed whose  voucher no matches to parent form voucher no  

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    Here a code from Martin. (Don't forget if two table have a relation it will come with range. You must clear that)

    MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct();
    selectionHelper.parmDataSource(FormDataUtil::getFormDataSource(this.args().record());
    
    QueryBuildDataSource lineQbds = jobLine_ds.queryBuildDataSource();
    
    JobTable jobTable = selectionHelper.getFirst();
    while (jobTable)
    {
        lineQbds.addRange(fieldNum(JobProjLine, JobId)).value(queryValue(jobTable.JobId));
        jobTable = selectionHelper.getNext();
    }

  • ergun sahin Profile Picture
    8,826 Moderator on at

    And don't use it for too many lines. I couldn't remember clearly but there was a limit for range

  • Community Member Profile Picture
    on at

    i am getting error at  

    selectionHelper.parmDataSource(FormDataUtil::getFormDataSource(this.args().record());

    error FormDataUtil is not a class

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Unfortunately you didn't react to what I wrote. And your new text, "whose  voucher no matches to parent form voucher no", sounds more like you want records related to a single voucher number. Could you clarify it, please? I can't tell you how you implement your requirement without knowing what the requirement is.

    By the way, FormDataUtil class exists in D365FO, not (AFAIK) in AX 2012.

  • ergun sahin Profile Picture
    8,826 Moderator on at

    Sorry it seems old ax don't have class but you can get ds from args too (dont forget checkin menuitem)

    I don't have ax, so I can't check it 2012 but something like this;

    args.record().dataSource()

  • Community Member Profile Picture
    on at

    in my current form there are 5 row's that mean  for each row i have different voucher number .

    i want when i click on button to open the child form , child form should show the record related to those voucher number which were available on my current form

    if i have 5 row's in my current form that means 5 voucher number and the child form should pick all the record related to those 5 voucher from the child form data source and   show them on child form .

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    5 range value is not a problem (I don't remember limit but I think its equal to filter length at the form).
    If you have only a field for range you dont need loop

    MultiSelectionHelper have method for range. You can do like this;

    MultiSelectionHelper helper;
           
        if (element.args() && element.args().caller() && element.args().record())
        {
            this.query().dataSourceTable(tableNum(form2Table)).clearDynalinks();
            helper= MultiSelectionHelper::createFromCaller(element.args().caller());        
            helper.createQueryRanges(this.query().dataSourceTable(tablenum(Form2Table)), 
            fieldstr(Form2Table, Field2),fieldstr(Form1Table, Field1));
        }

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

    I would say that a more intuitive design pattern might be that you select one or many records, then open the second form, and the second form would show records that are related to all the selected parent records (instead of all, potentially tens of thousands of records that the query of the parent form returned).

    Usually filtering on child form is based on the selected record on the parent form.

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 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans