| compare | Index Level | compile |
| Syntax |
compare-list {file.reference.a} list.a {operator} {file.reference.b} list.b {file.reference.c} {list.c} {(options)}
or, if primary and secondary lists are already active: compare-list {operator} {list.c} {(options} |
| Category | TCL |
| Type | Verb |
| Description |
forms a single list from two lists using intersection, union, or exclusion operators.
"compare-list" performs the operation (&, #, =, +, or -) on "list.a" and "list.b" and creates a new list, "list.c". If "list.c" is not specified, it overwrites "list.a". Operators and their meanings: & Represents an "and", or "intersection", which means that the item-ids must exist in both lists. # Represents a "not", or "exclusion", meaning that the item-ids must NOT exist in both lists. = Represents an "or", or "union", indicating that the item-ids may exist in either list. + Concatenates "list.b" to the end of "list.a". (list.a + list.b) - Removes item-ids in "list.b" from "list.a". (list.a - list.b) g Performs a "get-list" on "list.c". (Makes "list.c" active after the process.) s Generates and displays statistics about the items selected during the process. |
| Options | ? Displays help text on screen. |
| See Also | fl edit-list get-list sort-list nselect copy-list primary list active list sselect save-list select secondary list compare el delete-list |
| Example |
Assume that the two following lists are already created and reside in the "pointer-file".
list1 list2 001 cat 001 banana 002 dog 002 apple 003 banana 003 orange compare-list list1 + list2 Since no "list.c" was specified, "list1" is overwritten and contains "banana", "cat", "dog", "apple", "banana" and "orange". compare-list list1 + list2 list3 This example is exactly the same as the first example, but the list is saved as "list3". "list1" and "list2" remain unchanged. compare-list list1 # list2 list3 This example creates a "list3" which contains "apple", "cat", "dog" and "orange", since none of these appear in both "list1" and "list2". "list1" and "list2" remain unchanged. compare-list list1 = list2 list3 (gs list2 list1 list3 Sort time - faster than a speeding second. 3 3 5 Duty time - faster than a speeding second. [404] 5 items selected out of 1 items. This example creates and activates "list3" which contains "apple", "banana", "cat", "dog" and "orange", or all unique strings in both "list1" and "list2". "list1" and "list2" remain unchanged. compare-list list1 - list2 list3 This example creates a "list3" which contains "cat" and "dog". Those strings which exist in "list2" ("banana", in this case) are removed from "list1". "list1" and "list2" remain unchanged. compare-list list1 & list2 list3 This example creates a "list3" which contains "banana", since it is the only string which appears in both "list1" and "list2". "list1" and "list2" remain unchanged. |
| Warnings | Unless the "s" option is used, this process does not display any type of message indicating whether it worked or not. |
| Compatibility | D3 7.0 AP |
| compare | Index Level | compile |