---
title: "Rules - How to compare two values from the dataview"
description: "Comparing two values from the dataview uses Path Alias with a Relative Path in rules. The rule block section then compares these values to determine the status on the dataview."
url: "https://docs.itrsgroup.com/docs/faq/geneos/4407912762257-geneos-rules-how-to-compare-two-values-from-the-dataview/index.html"
---
## Related topics

Geneos rules, Gateway rules, rule block, rules, compare values, if operator

### Problem

Need to compare the value from the target data-cell with another value from the dataview.

### Possible solutions

You can use [Path Alias](https://docs.itrsgroup.com/docs/geneos/current/processing/monitoring-and-alerts/geneos_rulesactionsalerts_tr/index.html#rules--rule--pathaliases) with a [Relative Path](https://docs.itrsgroup.com/docs/geneos/current/processing/gateway-administration/geneos_xpath_ug/index.html#relative-paths) of the secondary cell in the rule block section.

For example:

1. Given a `cpu_sampler` dataview like the following:

![cpu_sampler dataview](https://docscdn.itrsgroup.com/faq/images/geneos/cpu-sampler-dataview.png)

2. Define the rule target to point at CPU **0%processorTime**:

![CPU 0%processorTime](https://docscdn.itrsgroup.com/faq/images/geneos/cpu-0-processor-time.png)

3. Define the path alias to point at CPU **1%processorTime** (Sampler **Advanced** tab):

![CPU 1%processorTime](https://docscdn.itrsgroup.com/faq/images/geneos/cpu-1-processor-time.png)

4. Define the rule block section to compare the values:

![CPU alias rule block section](https://docscdn.itrsgroup.com/faq/images/geneos/cpu-alias-rule-block.png)

5. Check the results on the dataview. Apart from the colour displayed on the data cell, you can also right-click and select the **Show Rules** menu to check that the gateway rule is applied.

- Ok status:

![Geneos Active Times](https://docscdn.itrsgroup.com/faq/images/geneos/cpu-sampler-ok.png)

- Warning status:

![Geneos Active Times](https://docscdn.itrsgroup.com/faq/images/geneos/cpu-sampler-warning.png)

- Critical status:

![Geneos Active Times](https://docscdn.itrsgroup.com/faq/images/geneos/cpu-sampler-critical.png)

## Related articles

- [How to compare cells on the same row](https://docs.itrsgroup.com/docs/faq/geneos/360008132338-geneos-how-to-compare-cells-on-the-same-row/index.html)
- [How do I calculate the difference in days between the current date and the expiry date of a license via a rule?](https://docs.itrsgroup.com/docs/faq/geneos/115004021605-geneos-gateway-how-to-compute-the-difference-in-days-between-the-current-date-and-a-given-date/index.html)
- [How do I find invalid targets in my rules?](https://docs.itrsgroup.com/docs/faq/geneos/115004030229-geneos-gateway-how-do-i-find-invalid-targets-in-my-rules/index.html)
- [What does the warning message "Ignored target for rule '<rule name>' as xpath contains non-identifying predicate" mean?](https://docs.itrsgroup.com/docs/faq/geneos/115004023585-geneos-gateway-what-does-the-warning-message-ignored-target-for-rule-rule-name-as-xpath-contains-non-identifying-predicate-mean/index.html)


