I am trying to create a scripted field that takes a integer status and returns a string status from a list.
the doc field returns an integer value and the list returns a string when I manually input an integer, but when I try to use the doc field as the index integer it returns an empty list.
def stat = ['unknown', 'onLine', 'onBattery', 'onSmartBoost', 'timedSleeping', 'softwareBypass', 'off', 'rebooting', 'switchedBypass', 'hardwareFailureBypass', 'sleepingUntilPowerReturn', 'onSmartTrim'];
the array --^
stat[doc['iso.org.dod.internet.private.enterprises.318.1.1.1.4.1.1.0'].value -1];
Returns
[]
while
stat[3]
Returns
[ "onSmartBoost", ...]
and
doc['iso.org.dod.internet.private.enterprises.318.1.1.1.4.1.1.0'].value -1
Returns
[3, ...]
so my question is if I'm getting integers for the doc and integers work as an index for the list why do I get an empty list?