You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've faced some issue with list filter and find some improvement that can help filter by list
classQuery...
# your solutiondeffilter(self, value) ->"Query[Q]":
""" Set ``$filter`` query parameter. Can be called multiple times. Multiple :py:func:`filter` calls are concatenated with 'and' :param value: Property comparison. For example, ``Entity.Property == 2`` :return: Query instance """q=self._new_query()
option=q._get_or_create_option('$filter')
option.append(value)
returnq
Improvement to extend list filter
classQuery...
# my solutiondeffilter(self, value) ->"Query[Q]":
""" Set ``$filter`` query parameter. Can be called multiple times. Multiple :py:func:`filter` calls are concatenated with 'and' :param value: Property comparison. For example, ``Entity.Property == 2`` :return: Query instance """q=self._new_query()
option=q._get_or_create_option('$filter')
ifisinstance(value, list):
option.extend(value)
else:
option.append(value)
returnq
e.g.
entity=entities[my_entity]
q=query(entity)
exclude_sids= ['6f98ba36-3b7f-4767-8369-88a65578dc5a', '5afa06fb-3b66-4216-8681-56acdeac7fc1']
sid_filters= [group_entity.Sid!=iforiinexclude_sids]
# filters by odata filter[Sid ne 6f98ba36-3b7f-4767-8369-88a65578dc5a, Sid ne 5afa06fb-3b66-4216-8681-56acdeac7fc1]q=q.filter(sid_filters).all()
# output log # Query: {'$filter': '(Sid ne 6f98ba36-3b7f-4767-8369-88a65578dc5a) and (Sid ne 5afa06fb-3b66-4216-8681-56acdeac7fc1)
Activity