Forum Discussion
Slicer Parameter Binding Using Primary Key
Just an update to say that I've got this working by changing the SQL query.
There are currently two Tables, an 'Event' Table listing all the data to be reported on, and a 'Machines' Table which provides specific details for each machine and relates to the 'Event' table using a MachineID.
So to solve my problem I have set the Slicer to use the 'Machine_Name' field and applied a parameter binding to this. But to resolve this to a MachineID I've used an INNER JOIN and an ON clause as shown below...
"SELECT * FROM Event INNER JOIN Machines ON Event.MachineID = Machines.Machine_ID AND Machines.Machine_Name = '" & MachineName & "'" & " WHERE EventTime >= '" & DateTime.ToText(StartDate,"yyyy/MM/dd") & "' AND EventTime < '" & DateTime.ToText(EndDate,"yyyy/MM/dd") & "'"
I'm also filtering by a date range in the above example.
Not sure if this is the preferred way to do this, but it works and seems reasonably quick.
Hope the info helps someone else that is maybe struggling with a similar problem.
Best regards,
RandomCoder