API Search in value list for "one of" condition

I'm developing UIX search panel, it doesnt work to search mutiple value in a value list, the script below for your advice, thanks

Here is the Conditions shown after created the search

var scKeyword = new MFiles.SearchCondition();
var oSc = new MFiles.SearchCriteria();

var ids = [1,3];

scKeyword.ConditionType = MFConditionType.MFConditionTypeEqual;
scKeyword.TypedValue.SetValue(MFDataType.MFDatatypeMultiSelectLookup, ids);

scKeyword.Expression.SetPropertyValueExpression(
  KeywordPropertyDefId, 
  MFParentChildBehavior.MFParentChildBehaviorNone,
  new MFiles.DataFunctionCall()
  );
var scexKeyword = new MFiles.SearchConditionEx();
scexKeyword.Set(scKeyword, true, false, false);

oSc.AdditionalConditions.Add(-1, scexKeyword);

Parents Reply
  • In your example application your lookup object instantiation uses the C#-style notation which doesn't work in JS.  It's being "run", but it's not doing what you think.  If you change your lookup instantiation and population to this then it should work:

    var lookup1 = new MFiles.Lookup();
    lookup1.Item = 145;
    var lookup2 = new MFiles.Lookup();
    lookup2.Item = 146;

    I don't know why the original idea of passing a plain JS array doesn't work; my assumption is that the API doesn't quite understand what that array is (it knows enough that it sees two items in it, but it can't see the actual IDs, so fails to search properly).

Children