Hi,
My report properly prompts for a collection name, but then yields nothing. If I run Query Designer on each dataset, they work fine. Any idea what I'm missing?
Dataset1
select distinct v_R_System.Netbios_Name0 as 'Computer Name',
V_GS_OPERATING_SYSTEM.Description0 as 'Image',
v_GS_SYSTEM_CONSOLE_USER.SystemConsoleUser0 as 'Last Logged On User',
v_GS_SYSTEM_CONSOLE_USER.LastConsoleUse0 as 'Last Logged On Time',
V_R_User.Full_User_Name0 as 'Full User Name'
from v_R_System
JOIN
v_GS_OPERATING_SYSTEM on
v_GS_OPERATING_SYSTEM.ResourceID = v_R_System.ResourceID
JOIN
V_GS_SYSTEM_CONSOLE_USER on
V_GS_OPERATING_SYSTEM.ResourceID = v_GS_SYSTEM_CONSOLE_USER.ResourceID
JOIN
v_R_USER on
v_R_USER.ResourceID = v_R_System.ResourceID
JOIN
v_FullCollectionMembership fcm on
fcm.ResourceType = v_R_System.ResourceType
WHERE fcm.Collectionid= '@Collection'
ORDER BY v_R_System.Netbios_Name0
Dataset2
select CollectionID, Name from v_Collection order by Name
While you have your report open also open SQL Profiler then see what that parameter looks like in the wire. What does the parameter value look like in SQL Profiler?
try also
WHERE rtrim(ltrim(fcm.Collectionid)) = rtrim(ltrim(@Collection))
This is just for test purposes to see if there could be some empty padding of some sort is causing this issue
WHERE fcm.Collectionid= @Collection
ORDER BY v_R_System.Netbios_Name0',N'@Collection nvarchar(8)',@Collection=N'TH10012E'
',@DataSourceInfo=0x0001000000FFFFFFFF01000000000000000C020000006E4D6963726F736F66742E5265706F7274696E6753657276696365732E50726F63657373696E67436F72652C2056657273696F6E3D31312E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579...and just keeps going
with the 3 columns IP, Computername and username you should have less rows but adding the other rows last hw scan and last scan date might not make things distinct. show us those rows for that same user bhj3772
The picture was just first 3 columns to display the issue. There are multiple columns as this is a detailed report based on collection request. I've never been able to get the "distinct" to actually work. Is there some fundamental circumstances that need to be in place for it to be effective?
In this case because the last column is slightly different your query will return two rows even if you have DISTINCT on this. So your other columns are making it so that you get multiple rows bcs they are indeed DISTINCT