Asi.ComparisonType.In doesn't work

I found that Asi.ComparisonType.In doesn't work.
I was making a call IQA function based on the input criteria. I need to use Asi.ComparisonType.In for one of my filters, the related source code is like the following:

Asi.QueryBuilder.QueryFilterSet queryFilterSet = myQuery1.FilterSets.Add();
Asi.QueryBuilder.QueryFilter queryFilter = queryFilterSet.Filters.Add(qualifiedName, "MemberType");
queryFilter.Comparison = Asi.ComparisonType.In;// Set comparison type here;
queryFilter.Value = "'V','CCM','M'";// Set filter value here;

It is for filtering all members whose MemberType is either 'V' or 'CCM' or 'M', in SQL where clause it should be [MemberType] in ('V', 'CCM', 'M')
But when I print the myQuery1.SqlCommandText(), I saw in where clause it still use [MemberType] = "'V', 'CCM', 'M'", which is same as Asi.ComparisonType.Equal

My version is 15.0.3
Any ideas?

Thanks.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Syntax may be a little wonky

Try the following for the filter value instead, I can't remember offhand if it's using the custom string split code for filter values or not:

queryFilter.Value = "\"V\",\"CCM\",\"M\"";// Set filter value here;

doesn't work

Thanks for the reply but it still doesn't work, the SQL generated by this way is:

...AND(vBoNetContact.MemberType = '""V"",""CCM"",""M""')

I believe in the system it interprete the Asi.ComparisonType.In same way as Asi.ComparisonType.Equal

Hm. I put together a little

Hm. I put together a little test program and ran it against my local 15.0.3 build.

                BusinessContainer container = new BusinessContainer();
                Query myQuery = Query.NewQuery(container);
                QuerySource source = myQuery.Sources.Add("CsContact");
                QueryFilterSet filterSet = myQuery.FilterSets.Add();
                QueryFilter filter = filterSet.Filters.Add(source.QualifiedName, "MemberType");
                filter.Comparison = ComparisonType.In;
                filter.Value = "\"V\",\"CCM\",\"M\"";

                Console.WriteLine(filter.SqlExpression());
                Console.WriteLine();
                Console.WriteLine(myQuery.SqlCommandText());

It printed the following:

(vBoCsContact.MemberType = 'V' OR vBoCsContact.MemberType = 'CCM' OR vBoCsContact.MemberType = 'M')

SELECT COUNT(*) AS 'Row Count' FROM  vBoCsContact WHERE (vBoCsContact.MemberType = 'V' OR 
vBoCsContact.MemberType = 'CCM' OR vBoCsContact.MemberType = 'M')

Which, granted, isn't generating a SQL IN, but the results are logically identical.

Can you describe the IQA query to me? Or send me an export of it (export it and send the .xml to emeans@advsol.com)?

It works!!!

Oh, yeah, I tested your code and it works fine.
In my page, I have to put the value into a dropdown list, but it is hard to put "\"V\",\"CCM\",\"M\"" as a dropdown item's value and retrieve correctly.

Anyway I solved it by writing an extra line in my code, now it works. Thanks for the help.

must be: ... AND(vBoNetContact.MemberType in ('V','CCM','M'))

I test the SQL in SQL server, only if the SQL is like the following:

... AND(vBoNetContact.MemberType in ('V','CCM','M'))

then I can retrieve the correct result.