Alpha Video Training
Results 1 to 3 of 3

Thread: setFilter() for list uses OR, not AND criteria. Is that able to be changes?

  1. #1
    Volunteer Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Versailles, KY
    Posts
    1,443

    Default setFilter() for list uses OR, not AND criteria. Is that able to be changes?

    Using the following javascript to filter the list of sample static data, two records get returned, Nancy Clark from Boston and John Smith from Boston, leading me to believe that the filter is using an OR condition, not an AND condition.
    Is there a way to get the criteria to return an AND condition, in this case only returning the John Smith from Boston record?
    var lObj = {dialog.object}.getControl('list1');
    //search for specific record
    lObj.setFilter(
    {
    Firstname: RegExp('John','i'),
    Lastname: RegExp('Smith','i'),
    City: RegExp('Boston','i'),
    State: RegExp('MA','i')
    }
    );
    Thanks,
    Jay
    Jay Talbott
    Lexington, KY


  2. #2
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,668

    Default Re: setFilter() for list uses OR, not AND criteria. Is that able to be changes?

    Test the data with an inline function...

    Code:
    lObj.setFilter(function(data){
    	if(data.FIRSTNAME == 'Robert' && data.LASTNAME == 'Smithxxxx' && data.BILL_CITY == 'Cambridge' && data.BILL_STATE_REGION == 'MA'){
    		return true;
    	}else{
    		return false;
    	}
    });
    https://documentation.alphasoftware....r%20Method.xml

  3. #3
    Volunteer Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Versailles, KY
    Posts
    1,443

    Default Re: setFilter() for list uses OR, not AND criteria. Is that able to be changed?

    David,
    Perfect, thanks.
    This is what I ended up using:
    var lObj = {dialog.object}.getControl('list1');

    lObj.setFilter(function(data){
    if(data.Firstname == 'John' && data.Lastname == 'Smith' && data.City == 'Boston' && data.State == 'MA'){
    return true;
    }else{
    return false;
    }
    });
    Jay Talbott
    Lexington, KY


Similar Threads

  1. list setFilter to select by index
    By Tbrondolo in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 03-13-2018, 02:18 PM
  2. List Control Client Side Filter... More than one criteria?
    By kiwibruce in forum Mobile & Browser Applications
    Replies: 4
    Last Post: 01-10-2018, 12:16 PM
  3. List control - save search criteria
    By jcarrallo in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 09-28-2017, 07:09 AM
  4. List setFilter AND or OR
    By jgrannis in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 07-18-2017, 05:31 PM
  5. Problem With Dual Criteria Filter Using SetFilter()
    By pbc83 in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 06-02-2015, 12:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •