Hi Guys,
I am trying to convert the below query to a!queryEntity()
SQL: SELECT COUNT(DISTINCT `COLUMN1`),`COLUMN2` FROM `TABEL ` WHERE ` COLUMN2` IN (id1,id2) GROUP BY ` COLUMN2 `
I want distinct count of COLUMN1 for each value in from COLUMN2
I have written the below logic in appian
aggregation: a!queryAggregation(
{
a!queryAggregationColumn(
field: " COLUMN1",
aggregationFunction: "COUNT",
isGrouping :true()
) ,
field: " COLUMN2",
)
}
It is working fine for one ID, But not getting desired output when i pass multiple ID
Can someone please help, Thank You:)
Regards,
Shashank
Discussion posts and replies are publicly visible
Full Code:
local!data: a!queryEntity( entity: consToDatabaseEntity, query: a!query( aggregation: a!queryAggregation( { a!queryAggregationColumn( field: "manufacturerId", isGrouping: true ), a!queryAggregationColumn( field: "deviceId", isGrouping: true, aggregationFunction:"COUNT" ) } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: if( rule!APN_isEmpty( ri!manufacturerId ), {}, { a!queryFilter( field: "manufacturerId", operator: "in", value: ri!manufacturerId ), } ) ), pagingInfo: local!pagingInfo ) )