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?
my question is how can I do these nested conditions in the expression rule ?
saras3430 said:how can I do these nested conditions in the expression rule ?
You can nest Logical Expressions within other Logical Expressions, creating complex conditions that AFAIK can handle pretty much any requirement for complexity. I can't begin to guess as to what exactly your use case here requires, but if you take the time to learn how this nesting works, you should be able to figure it out for yourself pretty easily.
yes I already tried to do that many times but I will try again thank you
Maybe you want to check out this list of query recipes to understand how this works.
https://docs.appian.com/suite/help/23.3/Query_Recipes.html