I have record type that get its source from data store entity and it has default filter and other user filters how can i query the same data using expression rule ?
for example we have fields in the data store entity startedBy , status , location , department , empId , addedOn
and the rule inputs for the expression rule are searchText , selectedLocation and createdOn
this is the default filter
a!queryLogicalExpression( operator: "OR", filters: { a!queryFilter( field:"status", operator: "=", value: 2, applywhen: a!isUserMemberOfGroup(loggedInUser(), cons!SP_MANAGER_GROUP) ), a!queryFilter( field: "startedBy", operator: "=", value: loggedInUser() ) } )
and this is the user filters that i want to use (this for user search )
logicalExpressions: a!queryLogicalExpression( operator: "OR", filters: {
a!queryFilter( field: "empId", operator: "=", value:tointeger(ri!searchText),
applyWhen:a!isNotNullOrEmpty(ri!searchText) ), a!queryFilter( field: "startedBy", operator: "includes", value: ri!searchText,
applyWhen:a!isNotNullOrEmpty(ri!searchText) ),
},
ignoreFiltersWithEmptyValues: true()
)
and this one for dropdown user filters like date and location filter
a!queryLogicalExpression( operator: "AND", filters: {
a!queryFilter( field: "addedOn", operator: "between", value: { ri!createdOn - intervalds("2", "59", "00"), (ri!createdOn + 1) - intervalds("2", "59", "00") }, applyWhen: a!isNotNullOrEmpty(ri!createdOn) ), a!queryFilter( field: "location", operator: "in", value:ri!selectedLocation , applyWhen: a!isNotNullOrEmpty(ri!createdOn) )},
how can i put them all together to get the right data
Discussion posts and replies are publicly visible
Firstly, please use the 'Insert>Insert Code' option to drop code snippets into your posts, it makes it much easier for folk to read, copy etc.
Secondly: I'm not sure what you mean when you say "put them all together to get the right data"...what do you think is wrong? Or do you simply not know where to add these filters?
a!queryLogicalExpression( operator: "OR", filters: { a!queryFilter( field:"status", operator: "=", value: 2, applywhen: a!isUserMemberOfGroup(loggedInUser(), cons!SP_MANAGER_GROUP) ), a!queryFilter( field: "startedBy", operator: "=", value: loggedInUser() ) } ) /*.....*/ logicalExpressions: a!queryLogicalExpression( operator: "OR", filters: { a!queryFilter( field: "empId", operator: "=", value:tointeger(ri!searchText), applyWhen:a!isNotNullOrEmpty(ri!searchText) ), a!queryFilter( field: "startedBy", operator: "includes", value: ri!searchText, applyWhen:a!isNotNullOrEmpty(ri!searchText) ), /*.....*/ a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "addedOn", operator: "between", value: {ri!createdOn - intervalds("2", "59", "00"),(ri!createdOn + 1) - intervalds("2", "59", "00")}, applyWhen: a!isNotNullOrEmpty(ri!createdOn) ), a!queryFilter( field: "location", operator: "in", value:ri!selectedLocation , applyWhen: a!isNotNullOrEmpty(ri!createdOn) ) }, ignoreFiltersWithEmptyValues: true() )