# Obtaining data source results

The ENEQueryResults class from the Presentation API is used to represent results of queries.

Components are always encouraged to add the relevant QueryConfig to specify what types of results they need. Calls to DataSource.execute(), without any arguments, will continue to work on ENE Presentation API data sources, but are deprecated.:

    QueryState query = getDataSource(request).getQueryState();
    query.addFunction(new NavConfig());
    QueryResults results = getDataSource(request).execute(query);

You can then get the underlying API results and do whatever manipulation is required by your component.

    ENEQueryResults eneResults = results.getENEQueryResults();

You can also make other local modifications to your query state before executing by adding filters or configurations to your query:

    QueryState query = getDataSource(request).getQueryState();
    query.addFunction(new ResultsConfig());
    query.addFunction(new RecordFilter("Region:Midwest"));
    QueryResults results = getDataSource(request).execute(query);

If you need to make modifications to your query that can't be represented on a QueryState, you can use ENEQuery instances directly:

    DataSource ds = getDataSource(request);
    ENEQuery eneQuery = ds.createENEQuery();
    //modify query...
    ENEQueryResults eneResults = ds.execute(eneQuery);

When you need to update a data source's state so that all associated components are updated, you cannot use ENEQuery instances—you must use QueryState instances.

    DataSource ds = getDataSource(request);
    QueryState query = ds.getQueryState();
    query.addOperation(new RecordFilter("Region:Midwest"));
    ds.setQueryState(query);