Comparing records and show only records that are not identical


I’m setting up a recipe management tool. And for this I would like to have a way to select two product and compare the two.

What I have done so far is the following:

Using a query where product 1 is filtered, iterate over records (query aggregation of ID) and run a connector function which filters on product 2, the record (parameter), and the field (target). If the target is not equal to the target of product 1, the connector outputs the ID of the record. Then I MAPTOTEXTLIST the output and push it onto an array. This loops until the aggregation array (ID’s of query) is empty. Then I go to the table query where the filter is ID is in array.

QUERY 1 {filter on product 1} => AGGREGATION {unique ID} => POP FROM ARRAY {Unique ID} =>LOAD RECORD {by ID} => RUN CONNECTOR FUNCTION {filter on product 2.product; product1.parameter,, output = ID} => MAPTOTEXT{output function} => PUSH ONTO ARRAY {ID ARRAY} => TABLE QUERY { filter = ID is in ID ARRAY}

But this takes quite some time, and is very shoddy & inefficient. Is there a better way to approach this? Also empty strings seem to cause problems.