.. _section-Comparing Query Results: Comparing Query Results ~~~~~~~~~~~~~~~~~~~~~~~ The **Compare with...** tab in **Query Results**, as highlighted in :numref:`figure-QueryResults-compare-with-tab.png`, can be used to compare new query results with older ones. Currently, in order to make use of the **Compare With...** feature, the set of query results being compared to must be saved to an .xml file using the **Save results to...** feature. More details about the **Save results to..** feature can be found in Section :ref:`section-Saving Query Results`. .. _figure-QueryResults-compare-with-tab.png: .. figure:: ../../figs/QueryResults-compare-with-tab.png :alt: **Compare with** tab for comparing current query results with saved results **Compare with** tab for comparing current query results with saved results To see an example of how to make use of **Compare with...**, execute the query ’What are all the grandparent/grandson pairs?’ and save the results using the **Save results to...** tab. Then, in the **KB Editor**, modify individual instance **Chris** by removing child **Falon** and adding child **Ivan**, as shown in :numref:`figure-QueryResults-remove-and-add-child-Chris.png`. .. _figure-QueryResults-remove-and-add-child-Chris.png: .. figure:: ../../figs/QueryResults-remove-and-add-child-Chris.png :alt: Remove **Falon** and add **Ivan** as child to individual **Chris** in **KB Editor** Remove **Falon** and add **Ivan** as child to individual **Chris** in **KB Editor** Save the changes to family.flr and rerun the same query. New query results should be different than before, as seen in :numref:`figure-QueryResults-compare-with.png`. .. _figure-QueryResults-compare-with.png: .. figure:: ../../figs/QueryResults-compare-with.png :alt: New query results for ’What are all the grandparent/grandson pairs?’ after **Darryn** is removed New query results for ’What are all the grandparent/grandson pairs?’ after **Darryn** is removed Click the **Compare with...** tab. Then navigate to the previously saved query results. Select to open it to do the comparison with, as seen in :numref:`figure-QueryResults-select-saved-results-to-compare-with.png`. .. _figure-QueryResults-select-saved-results-to-compare-with.png: .. figure:: ../../figs/QueryResults-select-saved-results-to-compare-with.png :alt: Select previously saved results for comparsion Select previously saved results for comparsion A new tab is generated in **Query Results** for the comparison, as highlighted in :numref:`figure-QueryResults-compare-with-new-tab.png`. .. _figure-QueryResults-compare-with-new-tab.png: .. figure:: ../../figs/QueryResults-compare-with-new-tab.png :alt: A new tab is added to **Query Results** for the comparsion results A new tab is added to **Query Results** for the comparsion results Click to open the new tab. Differences between the new and saved results are displayed in the main window. Across the top are the number of added, deleted and retained results, the location of the saved results being compared with, and the name of the comparison query tab. Comparison query tabs show added and deleted results by default. The added results are in green, while the deleted results are in red, as shown in :numref:`figure-QueryResults-compare-with-diff.png`. .. _figure-QueryResults-compare-with-diff.png: .. figure:: ../../figs/QueryResults-compare-with-diff.png :alt: Comparison to saved query results - additions are in green and deletions in red Comparison to saved query results - additions are in green and deletions in red To see all comparison results including the retained results, check the **Retained** checkbox next to the **Added** and **Deleted** checkboxes. The retained results appear in blue, as shown in :numref:`figure-QueryResults-compare-with-retained.png`. .. _figure-QueryResults-compare-with-retained.png: .. figure:: ../../figs/QueryResults-compare-with-retained.png :alt: Comparison results including **Added**, **Deleted** and **Retained** records Comparison results including **Added**, **Deleted** and **Retained** records Similar to other query results, comparison query results are by default sorted in ascending order by the first column variable. Within the same rank order, added and deleted results are displayed before retained results. In our comparison example, results are initially sorted by **?Grandparent**. Among the results which have **Aaron** as grandparent, the added **Aaron** / **Ivan** result is displayed before the retained **Aaron** / **Darryn** result. This can be seen in :numref:`figure-QueryResults-compare-with-retained.png`. To see results ordered by another column variable, click the corresponding column header. For example, :numref:`figure-QueryResults-Compare-sorted-by-grandson.png` shows the comparsion results sorted in ascending alphabetical order by **?Grandson**, after clicking the column header **?Grandson** once. .. _figure-QueryResults-Compare-sorted-by-grandson.png: .. figure:: ../../figs/QueryResults-Compare-sorted-by-grandson.png :alt: Comparison results sorted by **?Grandson** instead of **?Grandparent** Comparison results sorted by **?Grandson** instead of **?Grandparent** Sort order is reversed if the same column header is click again. For example, click the column header **?Grandson** again and the comparison results will be ordered by **?Grandson** in descending alphabetical order, as seen in :numref:`figure-QueryResults-Compare-sorted-by-grandson-reverse.png`. .. _figure-QueryResults-Compare-sorted-by-grandson-reverse.png: .. figure:: ../../figs/QueryResults-Compare-sorted-by-grandson-reverse.png :alt: Comparison results sorted by **?Grandson** in descending alphabetical order Comparison results sorted by **?Grandson** in descending alphabetical order