View Single Post
Old 12-31-2022, 09:57 AM   #21
ackomb
Zealot
ackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura about
 
Posts: 106
Karma: 4486
Join Date: Mar 2020
Location: Netherlands
Device: i-pad
Quote:
Originally Posted by chaley View Post
Are you looking for code that tells you if both "Show A" and "Show B" are in the list, perhaps along with other values such as "Show C"? If so and if you can guarantee that there are no duplicates in the list then this works.
Code:
program:
	show = list_count_matching($#show, '^(Show A|Show B)$', ',') == 2
	output = '';

	for item in $#pair:
		if show then
			if item ==  "ABC/XYZ" then ni = "AAA / BBB"
			elif item ==  "DEF/UVW" then ni = "CCC / DDD"
			else ni = item
			fi
		else ni = item
		fi;
		output = output & ',' & ni
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
This version is more robust in the face of duplicates but is a bit slower.
Code:
program:
	show = list_count(list_intersection($#show, 'Show A, Show B', ','), ',') == 2
[code as above]

Trying either of these 2 options actually gives me the following error:
EXCEPTION: Formatter: Expected end of program, found 'output' near Unknown on line 3
ackomb is offline   Reply With Quote