Comparison between 2 tables

How can I make a comparison between 2 tables? I want to check the bottom tables Badge_Num to the top tables BadgeNum and then change the row color of the top table:

Hers an example:

I’m going to show you how to do it with Python lists. This example assumes each row has some sort of unique value. From your screenshots, I’m going to use “Badge_Num”. This script is going to be placed in as a change script on Table_0.props.selection.selectedRow in my example, but you could modify it to go in other places and just target some index.

I verified this works for two tables using our default data (city/country/population).

def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	column_with_unique_value = "Badge_Num"
	if currentValue and currentValue.value is not None:
		target_index = None
		# data items can have different structures depending on styling
			# this covers entries with styling
			city =[currentValue.value].get(column_with_unique_value).get("value")
		except AttributeError:
			# this covers standard data
			city =[currentValue.value].get(column_with_unique_value)
		other_data = self.getSibling("Table")
		for i in range(len(other_data)):
			# We need the same handling in the other table
				if other_data[i].get(column_with_unique_value).get("value") == city:
					target_index = i
			except AttributeError:
				if other_data[i].get(column_with_unique_value) == city:
					target_index = i
		self.getSibling("Table").props.selection.selectedRow = target_index

This handling will be in BOTH tables, correct?

No, just the table where you are selecting a row manually. In your example above, this script would go into the bottom table.

4 posts were split to a new topic: How to obtain tag value from Qualified Value