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
4 replies
Subscribers
7 subscribers
Views
2076 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
I have a group of items that's being created in a rule and its format is lik
aswinb
over 11 years ago
I have a group of items that's being created in a rule and its format is like this:
[month = 3, year = 2013, number = 1],
[month = 3, year = 2013, number = 1],
[month = 3, year = 2013, number = 1],
[month = 3, year = 2014, number = 1],
[month = 3, year = 2014, number = 1],
[month = 4, year = 2014, number = 1],
[month = 4, year = 2014, number = 1]
I would like to get the count of the field 'number' that were created in the same month and same year. For instance if the month = 3 and year = 2014, I would like to get the count of the 'number' field for those dates. Any help would be deeply appreciated.
thanks...
OriginalPostID-106459
OriginalPostID-106459
Discussion posts and replies are publicly visible
0
larson.thune
Appian Employee
over 11 years ago
Wrap your CDT in todatasubset().totalCount
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jesse.triplett
Appian Employee
over 11 years ago
If you're looking for a specific month and year you can use wherecontains.
EG You could return the indices that match the year of interest, the indices that match the month of interest and intersect them, and count the result. Alternatively you could do it one line like below.
count(wherecontains(monthOfInterest,touniformstring(index(items,wherecontains(yearOfInterest,touniformstring(items.year))).month)))
If you're looking to do this dynamically for all combinations of unique month/year, you'll have to make some expression rules and apply over them, but the same principles apply.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aswinb
over 11 years ago
Yes Jesse, I am trying to do this dynamically for each month in different years and so a monthOfInterest and yearOfInterest can't be provided. There will be two given sets of dates and between those I have to count the number of items that were created each month and in each year that happens between the time intervals that the user selects.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Michael Tan
Appian Employee
over 11 years ago
For whatever data set you have returned, you can get the unique combination of month and year by merging the month and year arrays and taking the union of that array with itself. See rule below:
union(merge(a,b),merge(a,b))
For your example data set this would yield three combinations to check for (3-2013, 3-2014, and 4-2014).
You can use this with the expression Jesse mentioned to dynamically iterate over the original data set.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel