web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

filter a lookup field

(0) ShareShare
ReportReport
Posted on by 3,945

hi
one grid is there in my form , i have added a lookup method in one of the field of my grid and now i want to add filter on that very lookup method , and one thing more the filter should be based on two parameter .
i know how to add filter in lookup with one parameter , i have got this material from this site
http://ashokkancheti.blogspot.in/2014/03/x-code-to-filter-lookup-field-on-form.html
but i need to add filter in lookup method with two or more parameters. so tell me what should i do 


*This post is locked for comments

I have the same question (0)
  • Verified answer
    Sohaib Cheema Profile Picture
    49,664 Super User 2026 Season 1 on at

    you have to create one more object for QueryBuildRange qbr;

    and define filter/range for 2nd parameter also. Add 1 more range as you did 1st range.

  • Gautam Profile Picture
    3,945 on at

    Thanks Man ..its working now

  • Suggested answer
    Mallika Roy Profile Picture
    552 on at

    Hi Gautam,

    this can help you :

       Query query;

       QueryBuildDataSource qbds;

       QueryBuildRange qbr,qbr1;

       SysTableLookup lookup;

       query = new Query();

       qbds = query.addDataSource(tableNum(XXXTable));

       qbr = qbds.addRange(fieldNum(XXXTable,YYYField));

       qbr.value(queryvalue(_value1));

       qbr1 =  qbds.addRange(fieldNum(XXXTable,ZZZField));

       qbr.value(queryvalue(_value2));

       lookup

       =SysTableLookup::newParameters(tableNum(XXXTable),_callingControl,true);

       lookup.parmQuery(query);

       lookup.addLookupField(fieldNum(XXXTable,YYYField));    

       lookup.performFormLookup();

    }

  • Community Member Profile Picture
    on at

    Why my filter lookup query is looping? How to fix it?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 44

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans