this is the query how can i write a expression rule for this and the result will be like below
Discussion posts and replies are publicly visible
What's wrong with using QueryEntity or QueryRecordType (depending on which type of data you have configured within Appian)? These are both pretty powerful and you can filter to pretty much anything you want using a!queryFilter() or an array of filters contained in a!queryLogicalExpression().