Filter based on input parameter

I have a PostDetail screen. In this screen I have a button "Post Comments" and when I click in this button I want to redirect to the PostCommentsList. The PostCommentsList screen has a search input that allows search by comment text and post title. I have an Aggregate GetPosts with this filter:


Post.Title like "%" + Session.Post_SearchKeyword + "%" or
Comment.description like "%" + Session.Post_SearchKeyword + "%"


When the user in the PostDetaill sceren clicks on the button "Post Comments" it should redirect to the PostCommentsList and filter by default the table records with the clicked post. So I have an input parameter in the PostCommentsList screen "PostId" but Im in dobut about the best approach in terms of performance for this to show by default and filter by the input parameter. Thanks!

mvp_badge
MVP
Solution

That is a lot of conditions.

I'd start with the easiest one (match by id) and walk to the heavier ones.

PostId = Post.Id or (PostId = NullIdentifier() and (Post.Title like "%" + Session.Post_SearchKeyword + "%" or Comment.description like "%" + Session.Post_SearchKeyword + "%"))


Hi Jake B,

I think you could do it using:

PostId <> NullIdentifier() or PostId = Post.Id or
Post.Title like "%" + Session.Post_SearchKeyword + "%" or
Comment.description like "%" + Session.Post_SearchKeyword + "%"

It will not harm you solution at all.

Hope it helps

Best regards. 

Thanks but like that the post is not filtered, the filtered is not working. Do you know what can be the issue?

Jake B, sorry, I wrote the query in a wrong form. Nuno Reis corrected it bellow. Please, refer to his solution for a correct behavior.

Best regards.

mvp_badge
MVP
Solution

That is a lot of conditions.

I'd start with the easiest one (match by id) and walk to the heavier ones.

PostId = Post.Id or (PostId = NullIdentifier() and (Post.Title like "%" + Session.Post_SearchKeyword + "%" or Comment.description like "%" + Session.Post_SearchKeyword + "%"))


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.