Change the Grade Level to Numbers
  • 31 Jul 2023
  • 1 Minute to read
  • Dark
    Light

Change the Grade Level to Numbers

  • Dark
    Light

Article Summary

How to Change the Grade Level to a Number

The OneRoster data type standard for the grades field on the user record is string with specific values expected based on the grade.

The following example was used to convert a grade level of KG to 0 and PR to -1 allowing all other grade level values to remain the same.

function() {
  const grades = SRC.grade;

  if (grades) {

    const grade = grades[0];

      if (grade == 'KG') {
        return '0';
      } 

      else if (grade =='PR') {
        return '-1';
      } 
      
      else {
        return grades;
      }
    
  }
  
  return null;
   
}


Was this article helpful?