Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Pre-Filtering Reports in sql Query

Posted on by 5

Hi there.
I'm trying to implement Pre-Filtering Reports in sql Query
If I change my DB query from 
SELECT TOP (1000)
mcdsoft_id,
mcdsoft_ref_regionName,
mcdsoft_ref_combining_objectName,
mcdsoft_ref_blockName
FROM Filteredmcdsoft_real_estate

to 

SELECT TOP (1000)
mcdsoft_id,
mcdsoft_ref_regionName,
mcdsoft_ref_combining_objectName,
mcdsoft_ref_blockName
FROM Filteredmcdsoft_real_estate as CRMAF_Filteredmcdsoft_real_estate

and then I upload it as .rdl file it cause an error

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Command text is invalid.Detail: 

  fc94945a-ba7f-4535-acb4-46cacb722ccf
  -2147220733
  
    
      CallStack
         at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.Pipeline.<>c__DisplayClass2_1.b__0()
   at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)
   at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
   at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, Guid callerRegardingObjectId, Int32 invocationSource, Version endpointVersion, OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)
   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.DispatchRequest(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest, SdkResponseDescription responseDescription, SdkPerformanceCounterContext sdkPerformanceCounterContext)
   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequestRequestWithInstrumentation(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)
   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.<>c__DisplayClass17_0.b__0()
   at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)
   at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)
   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Guid targetCallerRegardingObjectId, UserType targetUserType, OrganizationContext context, Boolean returnResponse, Boolean checkAdminMode)
   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequestInternal(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)
   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)
   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)
    
    
      ApiExceptionSourceKey
      Plugin/Microsoft.Crm.ObjectModel.ReportService
    
    
      ApiOriginalExceptionKey
      Microsoft.Crm.CrmException: Command text is invalid. ---> Microsoft.Crm.CrmException: Command text is invalid. ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at Microsoft.Crm.SharedUtil.CreateXmlDocument(XmlReader reader)
   at Microsoft.Crm.SharedUtil.CreateXmlDocument(String xml)
   at Microsoft.Crm.Reporting.SRSReport.ConvertFetchDataSet(XmlNode dataset, XmlNode origFilterNode, XmlNode storedFilterNode, ExecutionContext context, XmlDocument defaultFilterDoc)
   at Microsoft.Crm.Reporting.SRSReport.SetupFiltering(String origFilter, ExecutionContext context)
   --- End of inner exception stack trace ---
   at Microsoft.Crm.Reporting.SRSReport.SetupFiltering(String origFilter, ExecutionContext context)
   at Microsoft.Crm.Reporting.SRSReport..ctor(String xmlContent, String originalFilter, Boolean convertReportToCrm, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.ReportServiceInternal`1.UpdateInternal(Report entity, Report origReport, ExecutionContext context)
   --- End of inner exception stack trace ---
   at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.Pipeline.<>c__DisplayClass2_1.b__0()
    
    
      ApiStepKey
      64cdbb1b-ea3e-db11-86a7-000a3a5473e8
    
    
      ApiDepthKey
      1
    
    
      ApiActivityIdKey
      fc94945a-ba7f-4535-acb4-46cacb722ccf
    
    
      ApiPluginSolutionNameKey
      System
    
    
      ApiStepSolutionNameKey
      System
    
  
  Command text is invalid.
  2021-08-19T11:53:48.3701687Z
  false
  
  
  
  

  • Boris K Profile Picture
    Boris K 10 on at
    RE: Pre-Filtering Reports in sql Query

    It doesn't work. Maybe I have to set up Reporting Server?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Pre-Filtering Reports in sql Query

    Hi Partner:

    Maybe you can try to add alias before each columns:

    SELECT TOP (1000)
    CRMAF_Filteredmcdsoft_real_estate.mcdsoft_id,
    CRMAF_Filteredmcdsoft_real_estate.mcdsoft_ref_regionName,
    CRMAF_Filteredmcdsoft_real_estate.mcdsoft_ref_combining_objectName,
    CRMAF_Filteredmcdsoft_real_estate.mcdsoft_ref_blockName
    FROM Filteredmcdsoft_real_estate as CRMAF_Filteredmcdsoft_real_estate

    Regards,

    Leah Ju

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans