Skip to main content
venkatrea696188
March 9, 2023
Question

Decimal Rating Component

  • March 9, 2023
  • 6 replies
  • 0 views

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
March 9, 2023
venkatrea696188
March 9, 2023

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

harshitb6843
March 9, 2023

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
March 9, 2023

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
March 9, 2023

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
March 9, 2023

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.