Saving switch level value in a variable outside parse

Hi Folks,

Can someone help me in order to save the switch level value inside a variable.
I am trying the below but it is throwing an exception in the debug: (I tried the get command too)

def low() {

def level = zwave.commands.switchmultilevelv1.SwitchMultilevelReport.format()
if (level < 20){
    state.up=true
 }
 else if (level > 20){
    state.up=false
}

Thanks