> For the complete documentation index, see [llms.txt](https://docs.liquidapps.io/liquidapps-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.liquidapps.io/liquidapps-documentation/working-with-zeus-sdk/zeus-basics/testing/fetching-table.md).

# Fetching Table

To fetch a table in zeus is easy, setup with:

<pre class="language-javascript"><code class="lang-javascript">const deployer = requireBox('seed-eos/tools/eos/deployer');
<strong>
</strong><strong>describe(`${contractCode} Contract`, () => {
</strong>    const code = 'oracle';
    let tableHelper;
    before(done => {
        (async () => {
            try {
                tableHelper = await deployer.deploy(ctrt, code);
                
...

const res = await tableHelper.eos.getTableRows({
    code: code,
    scope: code,
    table: 'table',
    json: true
});
console.log(res.rows[0])
</code></pre>

## Secondary index example

This is an example of using the [`getTableRowsSec`](https://github.com/liquidapps-io/zeus-sdk/blob/master/boxes/groups/dapp-network/dapp-services/services/dapp-services-node/common.js#L279) function to return a secondary index. This function takes the following arguments:

* rpc — rpc for leap instance
* code —The account who owns the table
* table — The name of the table as specified by the contract abi
* scope — The scope within the contract in which the table is found
* keys —Keys to satisfy secondary index query
* limit = 1 — limit of amount of rows to return
* key\_type — secondary index type, `i64, i128, i256, float64, float128, ripemd160, sha256`
* index\_position — Index number, 1 — primary (first), 2 — secondary index (in order defined by multi\_index), 3 — third index, etc

```javascript
const { getTableRowsSec } = requireBox('dapp-services/services/dapp-services-node/common');
...
let table = await getTableRowsSec(eos.rpc, dappServicesContract, "accountext", "DAPP", [null, testContractAccount, "ipfsservice1", "pprovider1"], 1, 'sha256', 2);
let first = Number(table[0].quota.replace(" QUOTA", ""));
```

More details available in this article: <https://medium.com/@NatPDeveloper/intro-to-antelope-smart-contract-unit-testing-with-zeus-50a6c1d7efce>.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.liquidapps.io/liquidapps-documentation/working-with-zeus-sdk/zeus-basics/testing/fetching-table.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
