Forum Discussion

swprabhu's avatar
swprabhu
Occasional Contributor
7 years ago

Enumerations

I am trying to validate enumerations but getting an error(null value) though I have created a map 'kind'. How to resolve

 

 

//reading the values from a response which has the output like 1,2,3
def Brep=slurpB.Message.ReturnRows.e.DocPrintBypassPrintSwitch.text()

 

//created a map for enumeartions

def kind=[ '1' : 'FormatReports', '2':'AllReports', '3': 'Error']

 

//logging the enumerated value
Brept=kind.Brep
log.info Brept

Output :Null

Expected : enumerated values

 

What should be done to get the enumerated value 

  • Hi,

     

    You need to use

     

    Brept = kind.get( Brep )

    instead of

     

    Brept = kind.Brep
  • nmrao's avatar
    nmrao
    Champion Level 3
    Question is unclear and only partial data available to comment.
  • Lucian's avatar
    Lucian
    Community Hero

    Hi,

     

    You need to use

     

    Brept = kind.get( Brep )

    instead of

     

    Brept = kind.Brep