Is there a way with a Maximo Automation Script to have values from a valuelist enabled or disabled based on the selection from another valuelist?

Viewed 215

Value list 1:

1 lista 2 listb 3 listc 4 listd

Value list 2:

a energy b freeze c baby d apple

If I select 1 from list one then only a is available within list 2.

from psdi.mbo import MboConstants

list = mbo.getString("LISTONE")
if list == "lista":
1 Answers

What you need is feasible using Python lists, available also in Jython. After creating a temporary list, you can find your corresponding value using different types of indexes.

from psdi.mbo import MboConstants

valueList = []
valueList.append([1,"lista","a","energy"])
valueList.append([2,"listb","b","freeze"])
valueList.append([3,"listc","c","baby"])
valueList.append([4,"listd","d","apple"])
# Transposing the matrix so that finding stuff becomes easy
valueListVert = map(list, zip(*valueList)) # list(map(list, zip(*valueList))) if using python 3

listOne = mbo.getString("LISTONE")

print(valueListVert[3][(valueListVert[1].index(listOne))]) # listOne = "listc" -> baby
print(valueListVert[2][(valueListVert[1].index(listOne))]) # listOne = "listb" -> b
print(valueListVert[3][(valueListVert[0].index(4))]) # -> apple
Related