<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tyson Moore &#187; remaining life</title>
	<atom:link href="http://www.tysonmoore.net/public/tag/remaining-life/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tysonmoore.net/public</link>
	<description>Consultant, Developer, Volunteer</description>
	<lastBuildDate>Tue, 15 Jun 2010 21:40:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Asset Management &#8211; Remaining Life</title>
		<link>http://www.tysonmoore.net/public/2010/01/asset-management-remaining-life/</link>
		<comments>http://www.tysonmoore.net/public/2010/01/asset-management-remaining-life/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 23:35:55 +0000</pubDate>
		<dc:creator>Tyson</dc:creator>
				<category><![CDATA[Asset Management]]></category>
		<category><![CDATA[PeopleSoft]]></category>
		<category><![CDATA[peoplesoft asset management]]></category>
		<category><![CDATA[remaining life]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.tysonmoore.net/public/?p=13</guid>
		<description><![CDATA[I had a request to create a query that would return an asset&#8217;s remaining life from PeopleSoft Asset Management 9.0.  This presumes you have loaded the PS_ASSET_NBV_TBL (asset NBV table) for the asset, that you are running it as VP1, and the Run ID used is NBV.  Obviously you should change these variables to match [...]]]></description>
			<content:encoded><![CDATA[<p>I had a request to create a query that would return an asset&#8217;s remaining life from PeopleSoft Asset Management 9.0.  This presumes you have loaded the PS_ASSET_NBV_TBL (asset NBV table) for the asset, that you are running it as VP1, and the Run ID used is NBV.  Obviously you should change these variables to match your current configuration.</p>
<pre name="code" class="sql">SELECT A.BUSINESS_UNIT, A.ASSET_ID, A.BOOK, A.IN_SERVICE_DT,
A.BEGIN_DEPR_DT, A.LIFE,
CASE
WHEN A.LIFE-(COUNT(D.ACCOUNTING_PERIOD)+((C.END_DT-A.BEGIN_DEPR_DT)/
     (C.END_DT-C.BEGIN_DT))-1) &lt; 0 THEN 0
ELSE A.LIFE-(COUNT(D.ACCOUNTING_PERIOD)+((C.END_DT-A.BEGIN_DEPR_DT)/
     (C.END_DT-C.BEGIN_DT))-1)
END AS REMAINING_LIFE
FROM PS_BOOK_CUR_VW A, PS_BU_BOOK_TBL B, PS_CAL_DETP_TBL C,
     PS_CAL_DETP_TBL D, PS_SET_CNTRL_REC T
WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT
AND A.BOOK = B.BOOK
AND A.BUSINESS_UNIT = T.SETCNTRLVALUE
AND T.REC_GROUP_ID = 'FS_02'
AND T.RECNAME = 'CAL_DETP_TBL'
AND C.SETID = T.SETID
AND B.CAL_DEPR_PD = C.CALENDAR_ID
AND D.SETID = T.SETID
AND B.CAL_DEPR_PD = D.CALENDAR_ID
AND A.BEGIN_DEPR_DT >= C.BEGIN_DT
AND A.BEGIN_DEPR_DT <= C.END_DT
AND D.END_DT >= C.END_DT
AND D.END_DT <= (SELECT DISTINCT N.AS_OF_DATE FROM PS_ASSET_NBV_TBL N
     WHERE N.OPRID = 'VP1' AND N.RUN_ID = 'NBV' AND A.BOOK = N.BOOK)
GROUP BY A.BUSINESS_UNIT, A.ASSET_ID, A.BOOK, A.LIFE, A.IN_SERVICE_DT,
     A.BEGIN_DEPR_DT, C.END_DT, C.BEGIN_DT
ORDER BY A.BUSINESS_UNIT, A.ASSET_ID, A.BOOK;</pre>
<p>Note: The SQL hasn't been performance tuned yet.  I will post ways to tune this SQL, or appropriate indexes for the tables referenced, once I have them identified.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.tysonmoore.net%2Fpublic%2F2010%2F01%2Fasset-management-remaining-life%2F&amp;partner=sociable" title="PDF"><img src="http://www.tysonmoore.net/public/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.tysonmoore.net%2Fpublic%2F2010%2F01%2Fasset-management-remaining-life%2F&amp;partner=sociable" title="Print"><img src="http://www.tysonmoore.net/public/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="mailto:?subject=Asset%20Management%20-%20Remaining%20Life&amp;body=http%3A%2F%2Fwww.tysonmoore.net%2Fpublic%2F2010%2F01%2Fasset-management-remaining-life%2F" title="email"><img src="http://www.tysonmoore.net/public/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Asset%20Management%20-%20Remaining%20Life%20-%20http%3A%2F%2Fwww.tysonmoore.net%2Fpublic%2F2010%2F01%2Fasset-management-remaining-life%2F" title="Twitter"><img src="http://www.tysonmoore.net/public/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.tysonmoore.net%2Fpublic%2F2010%2F01%2Fasset-management-remaining-life%2F&amp;t=Asset%20Management%20-%20Remaining%20Life" title="Facebook"><img src="http://www.tysonmoore.net/public/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.tysonmoore.net%2Fpublic%2F2010%2F01%2Fasset-management-remaining-life%2F&amp;title=Asset%20Management%20-%20Remaining%20Life&amp;source=Tyson+Moore+Consultant%2C+Developer%2C+Volunteer&amp;summary=I%20had%20a%20request%20to%20create%20a%20query%20that%20would%20return%20an%20asset%27s%20remaining%20life%20from%20PeopleSoft%20Asset%20Management%209.0.%C2%A0%20This%20presumes%20you%20have%20loaded%20the%20PS_ASSET_NBV_TBL%20%28asset%20NBV%20table%29%20for%20the%20asset%2C%20that%20you%20are%20running%20it%20as%20VP1%2C%20and%20the%20Run%20ID%20u" title="LinkedIn"><img src="http://www.tysonmoore.net/public/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.tysonmoore.net/public/feed/" title="RSS"><img src="http://www.tysonmoore.net/public/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.tysonmoore.net%2Fpublic%2F2010%2F01%2Fasset-management-remaining-life%2F&amp;t=Asset%20Management%20-%20Remaining%20Life&amp;s=I%20had%20a%20request%20to%20create%20a%20query%20that%20would%20return%20an%20asset%27s%20remaining%20life%20from%20PeopleSoft%20Asset%20Management%209.0.%C2%A0%20This%20presumes%20you%20have%20loaded%20the%20PS_ASSET_NBV_TBL%20%28asset%20NBV%20table%29%20for%20the%20asset%2C%20that%20you%20are%20running%20it%20as%20VP1%2C%20and%20the%20Run%20ID%20u" title="Tumblr"><img src="http://www.tysonmoore.net/public/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.tysonmoore.net%2Fpublic%2F2010%2F01%2Fasset-management-remaining-life%2F&amp;title=Asset%20Management%20-%20Remaining%20Life&amp;annotation=I%20had%20a%20request%20to%20create%20a%20query%20that%20would%20return%20an%20asset%27s%20remaining%20life%20from%20PeopleSoft%20Asset%20Management%209.0.%C2%A0%20This%20presumes%20you%20have%20loaded%20the%20PS_ASSET_NBV_TBL%20%28asset%20NBV%20table%29%20for%20the%20asset%2C%20that%20you%20are%20running%20it%20as%20VP1%2C%20and%20the%20Run%20ID%20u" title="Google Bookmarks"><img src="http://www.tysonmoore.net/public/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Asset%20Management%20-%20Remaining%20Life&amp;url=http%3A%2F%2Fwww.tysonmoore.net%2Fpublic%2F2010%2F01%2Fasset-management-remaining-life%2F" title="Netvibes"><img src="http://www.tysonmoore.net/public/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.tysonmoore.net/public/2010/01/asset-management-remaining-life/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

