Skip to main content
kavyan471063
Known Participant
September 27, 2021
Question

Getting distinct values from an entity

  • September 27, 2021
  • 3 replies
  • 0 views

Hi Everyone,

I have a query which will receive a text input based on that it will query data.(The data is like the reviews received for books under one particular genre, say I give my input as romance that will give all those reviews under all books in that genre), But I want to group it based on the book name. So I can get average ratings for a particular book.On grouping , I am getting only names of the book and not the other details. I have  attached the required snap of code for it.

In the First pic there is 9 items as output but when I group it the output will be 5 items. I want only the details of 5 items without repetition as in the second pic and I also want to know how to calculate average rating for these books.Please help me out guys!!

    3 replies

    danny.verb
    September 27, 2021

    It looks like you're querying from the wrong side. Instead of querying reviews, try querying books and then the reviews for each book. If you use Appian Records, you can easily group data by related fields

    kavyan471063
    Known Participant
    September 27, 2021

    Thanks for the reply, I grouped it based on the book_name and I got the avg of the reviews.But I am facing issue in retrieving the rating as icons. The input rating throws error  "Cannot index property 'rating' of type String into type List of Variant"

    kavyan471063
    Known Participant
    September 27, 2021