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

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

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    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.

  • Ram Kumar Profile Picture
    454 on at

    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.

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    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);

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Ram,

    Any luck with this?

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
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 241 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans