Working list selection filter

This commit is contained in:
Lyncoln
2026-10-12 11:28:07 -04:00
parent feb8af703a
commit 609c8f1384
28 changed files with 305 additions and 12 deletions
+45
View File
@@ -0,0 +1,45 @@
def buildSelect(response, action, outputs):
#if hasattr(action, "select"):
response_data = response.json()
#selection = action.select
#print(response_data)
select_data ={}
for item, index in action.select.items():
select_data[item] = response_data[item][index]
print(select_data)
#if select_data == None:
# selection = "not applied"
#else:
selection = select_data
return selection, action, outputs
def buildSelect2(action, outputs):
#print(outputs)
select_data = []
target = outputs[action.select["source"]]
selectmethod = action.select["selectmethod"]
targetkey = action.select["key"]
targetvalue = action.select["value"]
#for item in target:
for item in target:
#print (item)
for key, value in item.items():
if selectmethod == "exclude":
if targetkey == key and item[key] != targetvalue:
select_data.append(item)
#print(item)
if selectmethod == "include":
if targetkey == key and item[key] == targetvalue:
select_data.append(item)
#print(item)
print(select_data)
return select_data, action, outputs
#for item in outputs[output_name]:
#for key, value in action.select.include.items():
#if key in item and item[key] == value:
#select_data.append(item)