CRMAF not filtering to show record data

Today I had to deal with a report being generated out of Microsoft CRM. It was a custom report that I had built in SQL Report Server Report Builder. However it wasn't properly filtering the record data to show only the currently selected record.

The problem, it turns out, is that the CRMAF (CRM Auto Filter) code, doesn't like the full database path, or squared brackets.

So it doesn't like this:

SELECT 
[activityid],
[activitytypecodename],
[description],
[regardingobjectid],
[scheduledend],
[scheduledstart]
FROM
[CRM_MSCRM].[dbo].[FilteredServiceAppointment] as CRMAF_FilteredServiceAppointment

It will just generate the report but throw in all the records, rather than filter down to the one you have selected.

but if you remove the brackets and the absolute path to the database, all is well. 

SELECT 
CRMAF_FilteredServiceAppointment.activitytypecodename,
CRMAF_FilteredServiceAppointment.description,
CRMAF_FilteredServiceAppointment.regardingobjectid,
CRMAF_FilteredServiceAppointment.scheduledend,
CRMAF_FilteredServiceAppointment.scheduledstart,
CRMAF_FilteredServiceAppointment.serviceidname,
CRMAF_FilteredServiceAppointment.siteidname,
CRMAF_FilteredServiceAppointment.statecodename,
CRMAF_FilteredServiceAppointment.statuscodename,
CRMAF_FilteredServiceAppointment.subject
FROM
FilteredServiceAppointment AS CRMAF_FilteredServiceAppointment