Forum Discussion

dynamitemedia's avatar
dynamitemedia
Binge Watcher
15 years ago

user star ratings question

i have went thru all the examples and the component reference in the 2.7 sdk as well as searched the forum here. and see no example of this.

i have added the user ratings but when i click on it i am not getting info back on the console, i did a print and i can get when i click on it and the index number.

what am i missing ? does any one have a snipplet of what they are using on this? the back end is already waiting but cant seem to get any info from this button at present

2 Replies

  • The star rating is returned in msg.GetData() of the isButtonPressed() event.

    The documentation states the following:
    Boolean AddRatingButton(Integer id, String userRating,
    String aggregateRating)

    • Adds a star rating button to the screen. The rating is specified as a string whose value is
      an integer 1-100 which indicates the number of stars (1 to 5) to be displayed. Think of
      this as a percentage value <20% = 1 star. This button is displayed in the menu area of
      the screen and appears in the order added. The userRating specifies the value the user
      rated the title, while the aggregate Rating represents the total for all users. The
      userRating takes precedence and determines the color of the buttons if set. The
      aggregateRating may display half-stars. The button returns the userRating in the event
      data field.

    and

    isButtonPressed()
    • Event indicating a button on the screen was selected and the ID of the button
      that was selected.

    • Event Details: Type = 5, Msg = β€œβ€, Index = ID of button from AddButton(), Data =
      0 –or- value of user selection if the button type is a rating button.
  • thanks and for anyone inetersted the code is:

    if msg.getIndex() =   2    ' or whichever button you have it as

    userRating = msg.GetData()
    print "the user rating is : "; userRating

    ' save to DB here

    end if


    when i searched "userRating" i found the first part you showed, but it never showed up elsewhere with that term, i should have searched "Rating"

    Can't believe i didnt think of msg.GetData()

    well now its in the forum in case it snags someone else πŸ˜‰ , thanks Endless