I edited your MaxGrade field: Changed “FIT file field” to “None” and added this script:
{
let maxGrade = 0
for (let m of icu.fit) {
if (m._num !== 312) continue
for (let f of m) {
if (f.num !== 70) continue
console.log("f " + f)
if (f.value > maxGrade) maxGrade = f.value
}
} // 0 1 2 3 4 5 6 7 8 9 10 11 12 13
let grades = [null, "4", "5a", "5b", "5c", "6a", "6a+", "6b", "6b+", "6c", "7a", "7a+", "7b", "7b+"]
grades[Math.min(13, maxGrade)]
}
If you are happy with that please add a description and maybe a link to how the grades work and share it.
I referred to the JsFit object and other related fields to write the script.