I’m trying to figure out how to use an “OR” and an “IN” in a filter in an Angular app.
I can’t find any documentation on how to do this, nor any examples in the Portal code. So, I’m just guessing at what might work.
Anyone ever try this?
What I need to do is set a filter like…
select *
from Person
where
UID_Locality in ('02501ad6-a147-41ef-b07c-9d2c235fd8f9','0380d0e4-272f-4dec-9a57-a3165d9bed65') OR
UID_Department in ('00cf892d-7239-4bab-9ad7-9f9e4a0e97f0','014e0c99-c9c1-468a-a60c-245afbcff189')
I’m assuming I need a SqlExpression, and not the usual list of FilterData
No matter what I try, I keep getting the error “This operator is not valid for this comparison type.”
In Postman I get the same.
I’m guessing that my Angular code should look something like this…
loc_sql_filter = {
LogOperator: LogOp.AND,
PropertyId: 'UID_Locality',
Operator: 'in',
Value: ['02501ad6-a147-41ef-b07c-9d2c235fd8f9','0380d0e4-272f-4dec-9a57-a3165d9bed65']
};
dep_sql_filter = {
LogOperator: LogOp.AND,
PropertyId: 'UID_Department',
Operator: 'in',
Value: ['00cf892d-7239-4bab-9ad7-9f9e4a0e97f0','014e0c99-c9c1-468a-a60c-245afbcff189']
};
filters = [{
Type: FilterType.Expression,
Expression: {
LogOperator: LogOp.OR,
Expressions: [ loc_sql_filter, dep_sql_filter ]
}
}];
this.dstSettings = await this.dstWrapper.getDstSettings(
{ StartIndex: 0, filter: filters, search: undefined }
);
This translates into the following GET …
http://localhost:8182/portal/person/all?PageSize=20&filter=[{"Type":2,"Expression":{"LogOperator":1,"Expressions":[{"LogOperator":0,"PropertyId":"UID_Locality","Operator":"in","Value":["02501ad6-a147-41ef-b07c-9d2c235fd8f9","0380d0e4-272f-4dec-9a57-a3165d9bed65"]},{"LogOperator":0,"PropertyId":"UID_Department","Operator":"in","Value":["00cf892d-7239-4bab-9ad7-9f9e4a0e97f0","014e0c99-c9c1-468a-a60c-245afbcff189"]}]}}]
as I said, in PostMan I receive the same error. “This operator is not valid for this comparison type.”