For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 0 0 1

Pagination with EquitySearch

I tried the following code  and  an exception is throws as it is shown in attached figure. What am I doing wrong?

public void SearchEquities(string description)
        {
            SearchContext searchContext = new SearchContext(dssUri, SessionToken);
            searchContext.Preferences.MaxPageSize = 10;


            IDssEnumerable<EquitySearchResult> pagedResults = searchContext.EquitySearch(
             EquitySearchRequest.Create(
                 null, //Sub types
                 null, //Asset categories
                 null, //Company name
                 null, //Currency codes
                 description, //Description
                 null, //Domiciles codes
                 null, //Fair value indicator
                 null, //Exchange codes
                 null, //GICs codes
                 null, //File codes
                 null, //Org identifier
                 EquityStatus.Active, //Asset status
                 null, //Ticker
                 IdentifierType.Ric, //Identifier types
                 null, //Identifier
                 IdentifierType.Ric));


            Console.WriteLine("TotalCount = {0}", pagedResults.TotalCount);


            Console.WriteLine("HasNextPage: {0}", pagedResults.HasNextPage);
            Console.WriteLine("NextLink.Url: {0}", pagedResults.NextLink.Url);
            Console.WriteLine("Count: {0}", pagedResults.Count());


            int i = 1;
            Console.WriteLine("Page nº: {0}", i++);
            foreach (EquitySearchResult res in pagedResults)
            {
                Console.WriteLine("Description: {0}", res.Description);
            }


            while (pagedResults.HasNextPage)
            {
                pagedResults = searchContext.EquitySearch(pagedResults.NextLink);
                Console.WriteLine("HasNextPage: {0}", pagedResults.HasNextPage);
                Console.WriteLine("NextLink.Url: {0}", pagedResults.NextLink.Url);
                Console.WriteLine("Count: {0}", pagedResults.Count());


                Console.WriteLine("Page nº: {0}", i++);
                foreach (EquitySearchResult res in pagedResults)
                {
                    Console.WriteLine("Description: {0}", res.Description);
                }


            }
        }



dss-rest-apidssdatascope-select
captura.png (26.1 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvotes
Accepted
47.3k 111 44 60

@carlos.anaya

It looks similar to this question. Please increase MaxPageSize as a workaround.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.