---
title: "Sort numeric table values numerically"
description: "Verify that a numeric table column orders values by quantity rather than formatted text, including a zero and different digit lengths."
canonical_url: "https://vostride.com/agent-library/data-tables/numeric-sort-not-lexical.md"
md_url: "https://vostride.com/agent-library/data-tables/numeric-sort-not-lexical.md"
content_kind: "recipe"
topic: "data-tables"
---

# Sort numeric table values numerically

Verify that a numeric table column orders values by quantity rather than formatted text, including a zero and different digit lengths.

## Risk

A table can sort the rendered strings 2, 10, and 100 lexically while still showing a plausible arrow indicator. Distinct values and exact expected record order make the defect observable.

## Fixtures

- A test inventory table contains four rows with quantities 0, 2, 10, and 100 and unique row identifiers.
- The fixture manifest records ascending key order Zero stock, Two stock, Ten stock, Hundred stock.
- The table contract places all numeric values before missing values; this focused fixture contains no missing quantities or ties.

## Steps

1. Open the inventory table and verify all four fixture rows and their exact quantities are visible.
2. Select ascending sort on Quantity and verify the row identifiers appear in the prepared 0, 2, 10, 100 order.
3. Select descending sort and verify the identifiers reverse to the 100, 10, 2, 0 order.
4. Open Ten stock and verify its detail quantity is 10, then return to the table.
5. Reload the table and verify the product-defined sort persistence behavior, checking both indicator and row order together.

## Expected results

- Ascending and descending row membership order matches the independently recorded numeric oracle.
- The detail value agrees with the quantity displayed in the table.
- Every fixture row remains present once in each direction; sorting does not mutate quantities or omit zero.

## False-pass traps

- A correctly oriented sort arrow does not prove the comparator used numeric values.
- Checking only the first and last rows can miss a lexical swap among middle values.

## Cleanup

- Delete the inventory fixtures and reset the table sort preference.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa first test](/docs/agent-qa/guides/first-test.md)
- [agent-qa web testing](/docs/agent-qa/guides/web-testing.md)

- [Data table QA recipes](/agent-library/data-tables.md)
- [Software factory QA library](/agent-library.md)
