Options

How to define index/view from webservice

marvinqmarvinq Member Posts: 69
edited 2012-06-19 in NAV Three Tier
Hi,

Say I have build a CustomerFilter and a CustomerList function, to get customers in a given city (from c# via webservices) (se code).
        public List<CustomerList_Filter> CustomerFilter(string city)
        {
            List<CustomerList_Filter> filterListe = new List<CustomerList_Filter>();

            CustomerList_Filter filter = new CustomerList_Filter();
            filter.Field = CustomerList_Fields.City;
            filter.Criteria = "" + city;
            filterListe.Add(filter);

            return filterListe;
        }//CustomerFilter

        public CustomerList[] CustomerList(List<CustomerList_Filter> filter)
        {
            return customerList.ReadMultiple(filter.ToArray(), null, 1000);
        }//CustomerList

Anyone who knows how the general sorting is when writing such a code from c# to the NAV Webservice?? If a create a new SQL key with "City", will the webservice then automatically find the index that fits the best, or will it as default take the primarykey??

Is there any way to defines which index/view I would like to use? Searching for city I guess is quite "heavy".

/Marvin

Comments

  • Options
    kinekine Member Posts: 12,562
    Used Index is on SQL. SQL will decide which index will be used. Of course, sorting depends on key which is set on the page in NAV.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    marvinqmarvinq Member Posts: 69
    Okay, so setting the "SourceTableView" on the page to something like what I expect to search for will most likely improve speed?

    It would have been great if I was able to define the index from C#.
  • Options
    kinekine Member Posts: 12,562
    SourceTableView will change only Order by part of the select statement. Index will be still selected by SQL, based on all the rules used (statistics, filtered fields, sorting order and other) to generate best execution plan. It could have impact to this, but it is just on SQL what will select.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.