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 :
Finance | Project Operations, Human Resources, ...
Answered

Multiple Query Values In Range On Lookups

(0) ShareShare
ReportReport
Posted on by

Hello,

We have a requirement in which we have a table which has the following columns

1) Department Code (0,1,2,3,4...99)

2) Employee Position (A,B,C,D....Z)

3) Employee Name

We want to have a lookup on a string field in a form which would have employees showing up from 10 of the 100 department codes and 5 of the 26 employee positions

queryBuildRange = queryBuildDataSource.addRange(fieldNum(DEPARTMENTRESOURCES, Code));

queryBuildRange.value("LOOKING FOR THE VALUE TO BE INSERTED HERE");

queryBuildRange = queryBuildDataSource.addRange(fieldNum(DEPARTMENTRESOURCES, position));

queryBuildRange.value("LOOKING FOR THE VALUE TO BE INSERTED HERE");

Thanks & Regards,

Hitesh

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Use queryValue("MyCode1") as the argument of value(). To add more ranges for the same field, simply add another QueryBuildRange and set its value. For example:

    ds.addRange(fieldNum(DepartmentResources, Code)).value(queryValue("MyCode1"));
    ds.addRange(fieldNum(DepartmentResources, Code)).value(queryValue("MyCode2"));

    Obviously you can use a loop if you have filter values in a collection.

  • Community Member Profile Picture
    on at

    Thanks Martin

    So basically it'd be better if I just create another column which would act as a flag and use that as a query value instead

    Regards,

    Hitesh.

  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    I can't comment on that, because I don't know your scenario.

  • Community Member Profile Picture
    on at

    There are 2 conditions

    condition 1

    Check if the employees  of a particular department should show up in the grid

    condition 2

    if they belong to one of those 18 departments out of 30 departments

    check if their position in the firm has a grade which contains the alphabet 'A'

    The grades are like the below sample

    A1

    A2

    A3

    AB21

    AB23

    and so on

    after both these conditions are met

    the employees names should show up in the lookup.

    So, I have used a flag the departments and that filtering is easy

    however for positions we need to use something which would meet a condition which says does this persons grade contain the alphabet A

    so instead of using a string in the query

    can we use something which would be similar to using something like "(GradeId LIKE 'Aa%') in SQL"

    Regards,

    Hitesh.

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,095 on at

    Hi Hitest,

    For "Like" statements check methods SysQuery::valueLike and SysQuery::valueLikeAfter.

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 March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 669

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 445 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 331 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans