How to Change the Grade Level to a Number

RapidIdentity Platform Documentation

Solution
Application
Content Type
Technical Documentation
Utilities & Services
ft:locale
en-US

How to use a mapping expression in Studio to change a student's grade level from a string 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;
                
                }