Intersection of two JSON lists

This is a snack sized list processing sample.

It calculates the intersection of two lists, comprised of every list item that is in both lists, regardless of position.

Two preloaded text boxes allow you to enter your own test data.

I chose JSON format for the input, to allow entry of more complex list structures than the usual CSV format.

intersection.aia (3.2 KB)

initialize global list1 to
initialize global list2 to
Two global lists are used to feed the intersection value procedure.

Validation and JSON conversion:


Since this is applied to both text box texts, it is easier to do it in a procedure.
There is another Web block to do JSON translation into dictionaries, but it is inappropriate for this example. We will be working only with non-empty lists.

This intersection calculation is rather liberal,, alowing duplication of values.

Here is a stricter version, excluding duplicates (set intersection)

The result eliminates duplicates:
image

intersection.aia (3.3 KB)