Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
20 replies
Subscribers
11 subscribers
Views
10543 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Data and Records
Can we add two or more filters in facetOption
ramakg
A Score Level 1
over 7 years ago
Can we add two or more filters in facetOption? if not, is there any workaround solution?
a!facet(
name : "Status",
options : {
a!facetOption(
id : 1,
name : "Active",
filter : {
a!queryFilter(
field:"StartDate",
operator:"<=",
value: today()
),
a!queryFilter(
field:"EndDate",
operator:">=",
value: today()
)
}
)
},
defaultOption: "Active"
)
OriginalPostID-240150
Discussion posts and replies are publicly visible
0
sridevik7401
Certified Lead Developer
over 7 years ago
@ramakg we can add two or more filters using a!queryLogicalExpression().
please refer
forum.appian.com/.../System_Functions.html
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mayurm896
over 7 years ago
We can add 2 or more filters in facet options. With reference to your code, if you wish to filter out records based on date range you can try below mentioned code.
/* code to get records where issueDate falls in last week */
a!queryFilter
(
field: "issueDate",
operator: "between",
value:
{
date(year( today()),month(today()),day( today())) - 7,
date(year( today()),month(today()),day( today()))
}
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ramakg
A Score Level 1
over 7 years ago
@mayurm896, I am using two different fields to filter the data.
@sridevik, if I use a!queryLogicalExpression(), how to call this result in the facet option?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mayurm896
over 7 years ago
Please elaborate your requirement.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ramakg
A Score Level 1
over 7 years ago
I want apply the filter option like this:
StartDate>= today() and
EndDate <=today()
pls refer my sample code.
Thanks for your quick response
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
venkateshs329
over 7 years ago
@ramakg
As of my knowledge
You can create separate expression rule for query logical expression and call in facet option.
Please refer below link , it may helpful to you..
forum.appian.com/.../Expression-Based_User_Filters.html
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
vijay
over 7 years ago
Hi ramakg, as far I know when we want to filter data on different fields, we should not pass array of filters in filter pararmeter of faceOption function as it will take only first filter and ignoring second filter. We can go with queryLogicalExpression function,if we need to filter data based on multiple filter conditions.Let see what other practitioner will say....
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ramakg
A Score Level 1
over 7 years ago
@venkateshs329, I have gone through the link and able to fetch the data but how to call the result in facet option?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 7 years ago
@ramakg Following are the options for you as per my knowledge:
1. Try using the 'between' operator.
2. Add a column in database view(if you are using a table, switch to view as you may not want to alter a table for adding a filter) on which the Record Type is sourced. The new column should do the necessary evaluation in the database and return a single value(may be a boolean value) finally which can be configurable via query filter.
3. If you are using the Entity Backed record, convert it into Expression Backed record and drive the results based on rsp!query. This is a bit time consuming but I can say that this facilitates the kind of requirements you discussed much easily.
Given a chance, I will prefer the third one. And if there are time constraints, my option will be 1 and then 2 (if option 1 fails).
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 7 years ago
@ramakg Apologies, exclude the first option as you are trying to filter on two different fields.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>