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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 0 0 2

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-apidatascope-selectdss
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.

@carlos.anaya, thank you for your participation in the forum. Is the reply below satisfactory in resolving your query? If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question. Thanks, AHS

@carlos.anaya
Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.
Thanks,
-AHS

1 Answer

· Write an Answer
Upvotes
Accepted
79.2k 251 52 74

@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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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