{"id":94,"date":"2011-09-24T18:41:41","date_gmt":"2011-09-24T18:41:41","guid":{"rendered":"http:\/\/miguelontheweb.com\/wordpress\/?p=94"},"modified":"2011-09-25T18:16:34","modified_gmt":"2011-09-25T18:16:34","slug":"how-to-make-frigitd-with-sql","status":"publish","type":"post","link":"http:\/\/miguelontheweb.com\/wordpress\/?p=94","title":{"rendered":"how to make FRIGITD with sql."},"content":{"rendered":"<p>Often times you want to replicate a form query with plain ol sql. In this little example ill show you how to do just this very thing with FRRIGITD. The sql is pretty straight foward. Let me remind you<br \/>\nthat the grant ledger is inception to date. <!--more--><br \/>\nTherefore\u00a0 this query will show inception to date data as of the current date.<\/p>\n<pre class=\"brush: sql; gutter: true\">SELECT \n\n    m.frrgrnl_grnt_code,\n\n    m.frrgrnl_fund_code,\n\n    m.frrgrnl_Acct_code,\n\n    m.frrgrnl_orgn_code,\n\n    m.FRRGRNL_PROG_CODE,\n\n    SUM(m.frrgrnl_14_adopt_bud + m.frrgrnl_14_bud_adjt) BUDGET,\n\n    SUM(m.frrgrnl_14_ytd_actv) frrgrnl_14_ytd_actv,\n\n    SUM(m.frrgrnl_14_bud_rsrv) frrgrnl_14_bud_rsrv,\n\n    SUM(m.frrgrnl_14_encumb) frrgrnl_14_encumb,\n\n    SUM(m.frrgrnl_14_adopt_bud + m.frrgrnl_14_bud_adjt - m.frrgrnl_14_ytd_actv - m.frrgrnl_14_bud_rsrv - m.frrgrnl_14_encumb)Grant_total\n\n  FROM frrgrnl m--, FTVACCT\n\n  WHERE frrgrnl_acct_code NOT LIKE '5%'\n\n  AND m.frrgrnl_grnt_yr =\n\n    (SELECT MAX(s.frrgrnl_grnt_yr)\n\n    FROM frrgrnl s\n\n    WHERE s.frrgrnl_grnt_code =m.frrgrnl_grnt_code\n\n    AND s.frrgrnl_acct_Code   = m.frrgrnl_acct_code\n\n    AND s.frrgrnl_fund_code   =m.frrgrnl_fund_code\n\n    AND s.frrgrnl_orgn_code   = m.frrgrnl_orgn_code\n\n    AND s.frrgrnl_prog_code   = m.frrgrnl_prog_code\n\n    AND s.frrgrnl_locn_code   = m.frrgrnl_locn_code\n\n    AND s.frrgrnl_actv_code   = m.frrgrnl_actv_code\n\n    )\n\n  GROUP BY m.frrgrnl_Acct_code,\n\n    m.frrgrnl_grnt_code,\n\n    m.frrgrnl_fund_Code,\n\n    m.frrgrnl_orgn_code,\n\n    m.FRRGRNL_PROG_CODE\n\n  ORDER BY m.frrgrnl_grnt_code;<\/pre>\n<p>Word of caution on this query. I exclude accounts that start with 5. These are revenue account in my institution so i don\u2019t not want to include them for my purposes. The FRIGITD form allows you to exclude revenues, that is basically what i did by excluding the accounts that start with &#8220;5&#8221;. If you were trying to adapt this to your institution you should change this line to the accounts you were trying to exclude or simply just remove if you would like to see everything.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Often times you want to replicate a form query with plain ol sql. In this little example ill show you how to do just this very thing with FRRIGITD. The sql is pretty straight foward. Let me remind you that the grant ledger is inception to date.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[9,6,11,10],"class_list":["post-94","post","type-post","status-publish","format-standard","hentry","category-sungardbanner","tag-frigitd","tag-frrgrnl","tag-sct-banner-grant-ledger","tag-sungard-grant-ledger"],"_links":{"self":[{"href":"http:\/\/miguelontheweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/94","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/miguelontheweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/miguelontheweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/miguelontheweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/miguelontheweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=94"}],"version-history":[{"count":6,"href":"http:\/\/miguelontheweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/94\/revisions"}],"predecessor-version":[{"id":98,"href":"http:\/\/miguelontheweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/94\/revisions\/98"}],"wp:attachment":[{"href":"http:\/\/miguelontheweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/miguelontheweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/miguelontheweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}