cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
LJayP
Engaged Sweeper III
Hello,

I was wondering if there is a custom widget which will show a list of active or inactive Macs. I know the widget for active assets work but im trying to dim it down to just Imacs so I can add a separate widget to my homepage.

Thanks

Edit

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LastAssets.aspx.cs" Inherits="LastAssets" ResponseEncoding="utf-8" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="LS" %>
<% Response.CacheControl = "no-cache";%>
<% Response.AddHeader("Pragma", "no-cache"); %>
<% Response.Expires = -1; %>
<% LS.User.Current().CheckWebsiteAccess(); %>
<div style="margin: 2px;">
<table border="0" cellspacing="1" cellpadding="0">
<% foreach (DataRow myrow in dt.Rows)
{%> <tr>
<td align="left" valign="top" class="stippel"><img src="images/<% if ((int) myrow["assettype"] == -1)
{%><%: myrow["compimage"] %><% }
else
{%><%: myrow["AssetTypeIcon10"] %><% }%>" width="10" height="10" hspace="3" vspace="2" /></td>

<td align="left" valign="top" class="stippel"><a class="popup" rel="<%: myrow["AssetID"] %>" href="<%=ResolveUrl("~/")%>Asset.aspx?AssetID=<%: myrow["AssetID"] %>"><%: myrow["AssetName"] %></a><br />
</td>

<td align="left" valign="top" class="stippel"><%try{%>&nbsp;<span class="sml"><%= ((DateTime)myrow["lasttime"]).ToString(LS.User.Current().DateFormatTime)%></span><%}catch{}%></td>
</tr>

<% } %>
</table>
</div>
<%= AutoRefresh(30) %>


I was seeing if this can be edited to just look for macs instead of all assets?
1 ACCEPTED SOLUTION
Daniel_B
Lansweeper Alumni
The easiest way would be to add a new Data report or Chart report widget to your Dashboard which you use in combination with a custom report. The following report lists Mac assets counted by their asset state. If you save it under a name beginning with "Chart: ...", you will be able to use it for a Chart report widget.

Select Top 1000000 tblState.Statename,
Count(tblAssets.AssetID) As Number
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblState On tblState.State = tblAssetCustom.State
Where tsysAssetTypes.AssetTypename like 'apple mac'
Group By tblState.Statename
Order By tblState.Statename

View solution in original post

2 REPLIES 2
LJayP
Engaged Sweeper III
Thank you this seems to work, I will need to tweak it a bit but this is the base query I was after. Thank you, sorry for the all questions recently im still new to it all
Daniel_B
Lansweeper Alumni
The easiest way would be to add a new Data report or Chart report widget to your Dashboard which you use in combination with a custom report. The following report lists Mac assets counted by their asset state. If you save it under a name beginning with "Chart: ...", you will be able to use it for a Chart report widget.

Select Top 1000000 tblState.Statename,
Count(tblAssets.AssetID) As Number
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblState On tblState.State = tblAssetCustom.State
Where tsysAssetTypes.AssetTypename like 'apple mac'
Group By tblState.Statename
Order By tblState.Statename