Search code examples
c#mongodbsitecoresitecore8sitecore-analytics

Sitecore 8 (revision 150121), Analytics (MongoDB), Error "There is no row at position 0."


enter image description hereHello. my problem in Sitecore 8 Analytics - it's ERROR 'There is no row at position 0.', when I view tabs 'PROFILE' and 'OVERVIEW' of not anonimous user in a 'EXPERIANCE PROFILE'.

This error exist also in updates of Sitecore 8. What is causing this error?.


Solution

  • So, This problem is called by error of Sitecore developers.

    Having analysed the code of "FindBestPatternMatchAndApplyToProfileInfo" class and its methods I could find empty array (property "Rows" in a "dataTable" object), taken from elements. This causing out of range exception.


    This problem can be fixed by implementing of your own class (copy of FindBestPatternMatchAndApplyToProfileInfo) with adding "if"-statement for checking "Rows" field:

    private bool ApplyPatternToOneProfile(ReportProcessorArgs args, DataRow profileRow)
        {
            bool flag = true;
            if (DataRowExtensions.Field<Guid>(profileRow, Sitecore.Cintel.Reporting.Contact.ProfileInfo.Schema.ProfileId.Name) == Guid.Empty)
                flag = false;
            ViewParameters retrievingBestPattern = CustomProcessorViewPatternProfile.GetParametersForRetrievingBestPattern(args, profileRow);
            DataTable dataTable = CustomerIntelligenceManager.ViewProvider.GenerateContactView(retrievingBestPattern).Data.Dataset[retrievingBestPattern.ViewName];
            if (dataTable.Rows != null && dataTable.Rows.Count != 0)
            {
                if (!this.TryFillData<Guid>(profileRow, Sitecore.Cintel.Reporting.Contact.ProfileInfo.Schema.BestMatchedPatternId, dataTable.Rows[0], Sitecore.Cintel.Reporting.Contact.ProfilePatternMatch.Schema.PatternId.Name) || !this.TryFillData<string>(profileRow, Sitecore.Cintel.Reporting.Contact.ProfileInfo.Schema.BestMatchedPatternDisplayName, dataTable.Rows[0], Sitecore.Cintel.Reporting.Contact.ProfilePatternMatch.Schema.PatternDisplayName.Name) || !this.TryFillData<double>(profileRow, Sitecore.Cintel.Reporting.Contact.ProfileInfo.Schema.BestMatchedPatternGravityShare, dataTable.Rows[0], Sitecore.Cintel.Reporting.Contact.ProfilePatternMatch.Schema.PatternGravityShare.Name))
                    flag = false;
            }
            else
            {
                flag = false;
            }
    
            return flag;
        } 
    

    UPDATE:

    Alternatively you can solve this problem by the adding at least one pattern card in Sitecore Marketing Control Panel for corresponsing profile.(https://developers.coveo.com/display/public/SC201503/Understanding+Profiles+and+Pattern+Cards;jsessionid=D03AC5B4F9F4B4E588538BC977BE2F6D)