Custom Widget to show Imac Assets

Posted: Monday, June 15, 2015 2:25:25 PM(UTC)


Member Premium Users Original PosterPosts: 15
This issue has been solved! Click here to view the solution

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.



<%@ 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"] %><% }
{%><%: 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 align="left" valign="top" class="stippel"><%try{%>&nbsp;<span class="sml"><%= ((DateTime)myrow["lasttime"]).ToString(LS.User.Current().DateFormatTime)%></span><%}catch{}%></td>

<% } %>
<%= AutoRefresh(30) %>

I was seeing if this can be edited to just look for macs instead of all assets?
#1Daniel.B Member Posts: 1,150  
posted: 6/16/2015 2:22:33 PM(UTC)
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
#2LJayP Member Premium Users Original PosterPosts: 15  
posted: 6/16/2015 4:03:27 PM(UTC)
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 Angel

Active Discussions

Lansweeper Modifying Purchase Date / Yearly Refresh Report
by  Cripple.Zero  
Go to last post Go to first unread
Last post: 5/7/2021 7:06:47 PM(UTC)
Lansweeper Report showing only Wi-Fi Devices and MAC addresses
by  ethanthekiwi   Go to last post Go to first unread
Last post: 5/6/2021 9:18:07 PM(UTC)
Lansweeper Tweak LanSweepers Bios Version Audit to show Last Seen
by  Tyler M.  
Go to last post Go to first unread
Last post: 5/6/2021 8:22:40 PM(UTC)
Lansweeper Patch Volume Across Fleet
by  darren.kimber  
Go to last post Go to first unread
Last post: 5/5/2021 11:29:33 PM(UTC)
Lansweeper Show Date Without Time
by  nhouse24   Go to last post Go to first unread
Last post: 5/4/2021 10:39:43 PM(UTC)
Lansweeper Report of list of assets
by  Carlos Montes  
Go to last post Go to first unread
Last post: 5/4/2021 2:52:15 PM(UTC)