You need to sign in to do that
Don't have an account?
Aleksey Sheldagaev
How to get KnowledgeArticleVersion rows ordered by ViewStat in SOQL
How can I order by KnowledgeArticleViewStat.NormalizedScore when getting rows from KnowledgeArticleVersion table
My SOQL query looks like this:
My SOQL query looks like this:
SELECT Id, KnowledgeArticleId, ArticleType, LastPublishedDate FROM KnowledgeArticleVersion WHERE PublishStatus = 'online' AND Language = 'en_US' AND ArticleType IN ('...') LIMIT 5
But actually it's not exactly what I need, because query should returns only first 5 rows from KnowledgeArticleVersion which satisfies a condition.
I've found a way to make it:
All Answers
Then use custom sorting on the Implementing Comparable Interface : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_comparable.htm
Thanks
Shashikant
But actually it's not exactly what I need, because query should returns only first 5 rows from KnowledgeArticleVersion which satisfies a condition.
I've found a way to make it: