I have added a “isAccountedFor” column in a table:
Using this script:
table = self.getSibling("Table_0").props.data
accounted_badge_num = [B['Badge_Num'] for B in table]
json_obj = []
for V in value:
py_dic = dict(V)
if py_dic['BadgeNum'] in accounted_badge_num:
py_dic['isAccountedFor'] = True
else:
py_dic['isAccountedFor'] = False
json_obj.append(py_dic)
return json_obj
How can I get the row count and single out the “isAccountedFor” == True for color change?
Should I add another transform or do it in this transform?
if you put the data in value you can add a style object too
instead of
data[{"Badge_Num":5,"isAccountedFor"...},...]
somethingk like
data[{"value":{"Badge_Num":5,"isAccountedFor"...},"style":{"backgroundColor":"red"}}...]
#table should not be here? you should not get data from the table props thou
table = self.getSibling("Table_0").props.data
accounted_badge_num = [B['Badge_Num'] for B in table]
json_obj = []
for V in value:
py_dic = {"value":dict(V)}
if py_dic["value"]['BadgeNum'] in accounted_badge_num:
py_dic["value"]['isAccountedFor'] = True
py_dic["style"]={"backgroundColor":"red"}
else:
py_dic["value"]['isAccountedFor'] = False
json_obj.append(py_dic)
return json_obj
hmm, i see. that helps alot. I am still trying to get the hang of everything.