Skip to main content
venkatrea696188
Inspiring
Mar 9, 2023 6:31 AM UTC
Question

Decimal Rating Component

We can do Numerical rating in appian , Is it possible to create a Decimal rating like , on click of star once (0.5,1,1.5,.,.....)

6 replies

Participating Frequently
Mar 9, 2023 6:34 AM UTC
venkatrea696188
Inspiring
Mar 9, 2023 6:43 AM UTC

But it's static. I want it dynamic like selectable

harshitb6843
Brainy
Mar 9, 2023 6:36 AM UTC

Yes. But not directly as Appian has a half-star icon but not a mirror image of it. 

So one way to do it is to let the user click once to fill half star and click twice to fill the entire star. Or, just give them a list of options when adding the rating along a representation of how many stars they are rating and show that rating using the styled icons. 

venkatrea696188
Inspiring
Mar 9, 2023 6:41 AM UTC

Hey Harshit , Yeah i was thinking the same way but the thing is how to control the user click options.(how to made it selectable twice)

harshitb6843
Brainy
Mar 9, 2023 6:53 AM UTC

a!localVariables(
  local!index,
  local!rating,
  a!richTextDisplayField(
    labelPosition: "COLLAPSED",
    value: a!forEach(
      items: enumerate(5),
      expression: a!richTextIcon(
        icon: if(
          tointeger(local!index) > fv!index,
          "star",
          and(
            tointeger(local!index) = fv!index,
            todecimal(local!rating) = 0.5
          ),
          "star-half-o",
          and(
            tointeger(local!index) = fv!index,
            tointeger(local!rating) = 1
          ),
          "star",
          "star-o"
        ),
        size: "LARGE",
        link: a!dynamicLink(
          saveInto: {
            a!save(
              local!rating,
              if(
                or(
                  tointeger(local!index) <> fv!index,
                  a!isNullOrEmpty(local!rating)
                ),
                0.5,
                1
              )
            ),
            a!save(local!index, fv!index),
            
          }
        )
      )
    )
  )
)

stefanhelzle0001
Brainy
Mar 9, 2023 7:31 AM UTC

Why not just go with 10 stars? That would make the user interaction way easier. But, what would be the difference between 6 and 7? I mean, do you really need that many steps? There is a reason Amazon uses only 5.