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

Multilookup Filter Control

(0) ShareShare
ReportReport
Posted on by 454

Hi,

I have to filter my Form using the Customer Account Field. I am Using Multiselect lookup control. When i select only one Range it works correctly. But when i select multiple Values its not working. Help me on this. Here i have attached my code. Thanks in Advance.

public void executeQuery()
{
        Query query1 =                    new Query();
        QueryBuildDataSource             qbds1;
        QueryBuildRange                      queryrange;
        QueryRun                         queryrun1;
        str Custacc       = CustAccount.valueStr();
         qbds1      = this.query().dataSourceTable(tableNum(SalesTable));

        qbds1.addRange(fieldNum(SalesTable,CustAccount)).value(queryValue(Custacc));


    super();
}

Multilookup1.PNGMultilookup2.PNGMultilookup2.PNG

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Multilookup Filter Control

    Hi Ram,

    Any luck with this?

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Multilookup Filter Control

    Hi Ram,

    Please try something like this -

    ListEnumerator  listEnumerator;
    container       conRangeCriteria;
    str             range = '';
        
    list = Global::strSplit(list, ';');
    
    listEnumerator = list.getEnumerator();
    while (listEnumerator.moveNext())
    {
    	conRangeCriteria  = listEnumerator.current();
    }
    range = SysOperationHelper::convertMultiSelectedValueString(conRangeCriteria);
    range = strReplace(range, ";" , ", ");
    
    qbds.addrange(fieldnum(SalesTable, CustAccount)).value(range);

  • Ram Kumar Profile Picture
    454 on at
    RE: Multilookup Filter Control

    Hi Gunjan,

    public boolean modified()
    {
        boolean ret;
    
        ret = super();
       SalesTable_ds.query().dataSourceTable(tableNum(SalesTable)).clearRanges();
        SalesTable_ds.executeQuery();
    
        return ret;
    }

    public void lookup()
    
    {
    
           Query query =                    new Query();
    
           QueryBuildDataSource             qbds;
    
           QueryRun                         queryrun;
    
           ListIterator                     itr ;
    
          SysLookupMultiSelectCtrl          syslookupmulty;
    
           List   list            =   new List(Types::String);
    
           list            =   strSplit(CustAccount.valueStr(),";");
    
           itr             =   new listiterator(list);
    
           qbds            =   query.adddatasource(tablenum(SalesTable));
    
           qbds.fields().addfield(fieldnum(SalesTable,CustAccount));
    
               while(itr.more())
    
               {
    
                    qbds.addrange(fieldnum(SalesTable, CustAccount)).value(itr.value());
    
                    itr.next();
    
               }
    
           queryrun      =   new QueryRun(query);
    
           syslookupmulty = syslookupmultiselectctrl::constructWithQueryRun(element,CustAccount,queryrun);
    
        super();
    
    }

    Here is my Lookup code and Modified method on String edit filter control.

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Multilookup Filter Control

    Hi Ram,

    For multi select controls, are you not storing the selected values in containers?

    Please share the code for how you were adding the range in that case.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,430 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,043 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans