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
16 replies
Subscribers
8 subscribers
Views
5275 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hello, I am trying to do a filter the data of an entity and to then aggrega
Adel Ammari
over 9 years ago
Hello,
I am trying to do a filter the data of an entity and to then aggregate that data in a report. Below is the code and its result, please advise:
a!queryEntity(
entity: cons!cons_HRES_EmployeeSatisSurvery_DSE,
query: a!query(
logicalExpression: a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(field: "EMP_DEPARTMENT", operator: "in", value: { " HR", "IT","Legal" })
}
),
aggregation: a!queryAggregation(
aggregationColumns: {
a!queryAggregationColumn(
field: "EMP_LOCATION",
isGrouping: true
),
a!queryAggregationColumn(
field: "PID",
aggregationFunction: "COUNT"
)
}
),
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: -1,
sort: a!sortInfo(
field: "PID",
ascending: false
)
)
)
)
Output:
Could not display interface. Please check definition and inputs.
...
OriginalPostID-195705
OriginalPostID-195705
Discussion posts and replies are publicly visible
0
Adel Ammari
over 9 years ago
...Interface Definition: Not a valid component. Received: [startIndex=1, batchSize=-1, sort=[field=PID, ascending=false], totalCount=3, data=[EMP_LOCATION:Riyadh,PID:24]; [EMP_LOCATION:Jeddah,PID:1]; [EMP_LOCATION:Dahran,PID:1], identifiers=]
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Rahul Gundu
over 9 years ago
Hi Adela, Based on my understanding, you are created this rule in interface. Rather create a expression rule using option "Create an Expression Rule". After, by making use of this rule create a report using option "Create an interface". The below link gives you an idea, how to write a queryEntity()
forum.appian.com/.../Query_Recipes.html
After this create a report using interface
forum.appian.com/.../SAIL_Recipes.html
Hope it helps.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 9 years ago
The result looks good when you would have and expression. This seems to be a SAIL interface definition.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
Alternatively, in the same interface, the output of the query entity can be associated with a local variable and the output can be displayed by making use of a SAIL component.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Adel Ammari
over 9 years ago
My problem basically is using a filter with aggregation. If any of you have a sample that would be great.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sidhant Behura
over 9 years ago
@adela - Consume the datasubset returned from the queryEntity in a local variable and show the data in a SAIL component (like pie chart or grid).
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Adel Ammari
over 9 years ago
I know, this expression needs to be saved in a rule, I am using the interface designer for testing purposes only. And as indicated above, my problem is only with using both filter and aggregation together!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
@adela Ah I see, would you please be able to let us know the problem you have been experiencing currently with respect to usage of filters along with grouping?
You are asking for a sample but whatever code you have presented in the post is correct as per my knowledge and there isn't a problem with the way you are applying filters or grouping.
Just in case, if you aren't aware of this already - Filters are applied prior to grouping and aggregation operations.
If you are expecting a different functionality out of this implementation, please feel free to elaborate and discuss, and the community will provide you with elegant suggestions.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
narasimhaadityac
A Score Level 2
over 9 years ago
Hi Adela, can we use multiple a!queryFilter based on the input availability. For example define a rule input which is present as part of search criteria and use if(rule!APN_isBlank(times!input),{},a!queryFilter()). Can you please give a try using this.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Adel Ammari
over 9 years ago
@narasimhaadityac, i didn't quite understand what you mean, please elaborate.
@sikhivahans, i think its just 'my bad', the result "Could not display interface. Please check definition and inputs." is normal as i have not defined any sail components, that explains why i got the answers above. Thanks for your help guys, but i think there is no issue to discuss here.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>