Hi All,
I have below code where i need count of records where mentioned fields are not null. But i am not getting my desired output. Please correct me where i am missing.
I just want final output is count only.Now i am getting sum of total count and output result is also equal to total number of rows which is wrong. please suggest if u have any idea
a!forEach(local!datasubset.data, if(and(rule!APN_isBlank(local!datasubset.data["test1"]),rule!APN_isBlank(local!datasubset.data["test2"])),{}, count( local!datasubset.data["id"] ) ))
Discussion posts and replies are publicly visible
Appian treats a boolean true value like a 1 and a boolean false value like a 0. The sum() function can calculate the sum of a list of values. When you change your code to something like this
sum( a!forEach( items: local!datasubset.data, expression: and( rule!APN_isBlank(fv!item.test1), rule!APN_isBlank(fv!item.test2) ) ) )
This also follows the best practice of using keyword syntax for function parameters and uses fv!item inside foreach()
Thanks a lot