Knowledge Base Article

Aurora: Create a ranking formula

For a rank to work as intended, you need to write a ranking formula outlining the criteria needed for a member to achieve that rank. Our default ranks already have criteria associated with them; you can use these for a quick Ranks setup or you can view them for more examples on how ranking formulas are written. 

The format for a formula is:

(variable operator value) Boolean operator (variable operator value)

A variable is one of the member metrics captured by the system. Examples of member metrics include number of accepted solutions, number of posts, number of post views, and number of minutes online.

Note: To view a list of the Aurora member metrics you can use in your ranking formulas, refer to Member metrics for ranking formulas.

A value is the measurement that you want the metric to have. A value can be numeric or alphabetic. For example, if the metric is minutes online, the value will be a specific number of minutes. If the metric is user ID, the value will be a username.

The operator indicates the relationship between the metric and the value.

The relationship can be numerical or text-based. These are the operators you can use:

Operator  Description
== Equal (numeric or text)
!= Not Equal (numeric or text)
>= Greater Than or Equal
<= Less Than or Equal
Text Concatenation 
+ Numerical Plus
- Numerical Minus
* Numerical Multiply
/ Numerical Divide


The Boolean operator defines a relationship between two or more variable expressions. Each variable that you set as a criterion is a separate expression. You can use these Boolean operators:

Operator  Description
! Boolean Not
&& Boolean And
|| Boolean Or

 
You must enclose each variable expression (variable + operator + value) in parentheses. You can also combine variables to calculate values that the system may not otherwise provide. For example, to calculate the number of posts a member has made, you would start with the posts metric and subtract the deleted_posts metric. In a formula, it would look like this:

(posts - deleted_posts>=35)

Posts - deleted_posts is the variable, >= is the operator, and 35 is the value.

Here is a more complex example containing many metrics—it defines the age of the account, the number of content contributions (e.g., posts, articles, and comments), and the community engagement level (e.g., number of accepted solutions and likes) required for achieving the rank:

(registrationAge >= 259200) && ((((net_threads) + (net_replies*2) + (net_blog_articles*10) + (net_blog_comments) + (net_idea_threads*5) + (net_idea_comments) + (net_contributed_posts*5) + (net_published_tkb_articles*10) + (net_tkb_comments)) >=7000)||(overall_posts >10500)) && (((net_accepted_solutions*10) + (net_kudos_weight_given) + (net_kudos_weight_received*2) + (tagging_tag_count)) >=2800)

Custom fields that have been added to your community can also be included in ranking formulas. For example, a ranking formula composed entirely of custom fields may look like this:

((userInfo("c_fields_int.total_courses_count"))+(userInfo("c_fields_int.total_pathways_count"))+(userInfo("c_fields_int.academy_signin_count")*10)>=200) && userInfo("c_fields_string.favorite_disney_character")=="Mickey"

Written in a standard mathematical expression, this translates to:

(Total Khoros Academy Courses Completed) + (Total Khoros Academy Learning Pathways Completed) + (Academy Sign-ins Count * 10) >= 200 AND Favorite Disney Character = Mickey

This means that a member receives the rank only when the combined total of their completed Khoros Academy courses, learning pathways, and sign-ins multiplied by 10 is greater than or equal to 200… and their favorite Disney character listed on their member profile is Mickey.

To compose a ranking formula:

  1. Go to Admin > Settings > Users > Ranks.
  2. In the row of the rank whose formula you want to edit, open the Options menu and then Edit (or select Add Rank to add a new rank with a formula).
  3. In the Criteria field, enter the formula you want to use.
  4. Select Save Changes.

The rank now uses the criteria from the formula you added.

Related topics:

Updated 2 months ago
Version 12.0

5 Comments

  • Is there similar access to custom profile field data for ranks?
    For example.

    Custom profile field "isManager" exists, if its not empty the user is a manager. I want to use Ranks to assign the "isManager" role.

    I get an error whenever I try and get it to look at the custom field.
    This is accessible for badges 

    Im following the same logic, but its failing.

     

  • LarryI's avatar
    LarryI
    Khoros Expert
    10 months ago

    MorganBB In Classic, we supported using custom profile field data such as: userInfo("profile.custom_setting")

    In Aurora, we will test this out with the inclusion of custom metadata and custom fields available in 24.2. Once this is supported, we will update the documentation.

  • It seems that it's not possible to have a rank without criteria, so how can I ensure that the 'Community Manager' role for example is connected with the Administrator role, and it's not possible for someone to rank up to Community Manager?

     

  • LarryI's avatar
    LarryI
    Khoros Expert
    9 months ago

    SheenaK For role related criteria, use this for your Community Manager rank:

    hasRole("Administrator")

     

    You can copy it exactly as it is in the block and it'll work.