Challenge accepted.
I thought I would take the opportunity to try to wrap my head around PIVOT. The LANSweeper report editor won't let you do this directly (or it won't on my installation, at least), but if you're willing to edit the view that the editor creates on the server, it can be done.
Step 1: create a basic report in LANSweeper, naming it as whatever you want the resulting grid report to be called. The built-in report editor doesn't support PIVOT, so you need to set things up as if this is the final form of the report. Take note of the view name created when you save the report. (i.e. http://
yourserver:82/report.aspx?det=
web50long-hex-value)
Step 2: use your preferred SQL management tool to connect to the server and script the above view to an ALTER script.
Step 3: isolate the SELECT statement and replace it with
SELECT
AssetTypeName,
[your IP group name 1],
[your IP group name 2],
[your IP group name 3],
[Null]
FROM
( SELECT Top 1000000
IsNull(tsysIPLocations.IPLocation, 'Null') AS IPLocation,
tsysAssetTypes.AssetTypename,
tblAssets.AssetID
FROM
tblAssets
INNER JOIN tblAssetCustom ON tblAssets.AssetID = tblAssetCustom.AssetID
INNER JOIN tsysAssetTypes ON tsysAssetTypes.AssetType = tblAssets.Assettype
LEFT JOIN tsysIPLocations ON tblAssets.IPNumeric >= tsysIPLocations.StartIP And tblAssets.IPNumeric <= tsysIPLocations.EndIP
WHERE
tblAssetCustom.State = 1
) AS pivotSource
PIVOT
( Count(AssetID)
FOR IPLocation IN ([your IP group name 1], [your IP group name 2], [your IP group name 3], [Null])
) AS pivotResult
Substitute your actual IP group names for "your IP group name 1", "your IP group name 2", etc.
I included
[Null] because I noticed that I have some assets, primarily monitors, that, not surprisingly, don't have associated IP groups. If you want a different label, change the "
IsNull(tsysIPLocations.IPLocation, 'Null') AS IPLocation," and reflect that by replacing the two
[Null]s to match your new label.
No promises; this is my first attempt at using PIVOT and you need to work outside the LANSweeper editor, but my output looks like what you described.