{"id":389,"date":"2013-02-04T15:35:14","date_gmt":"2013-02-04T20:35:14","guid":{"rendered":"https:\/\/danvanfleet.com\/?p=389"},"modified":"2013-03-11T13:33:02","modified_gmt":"2013-03-11T18:33:02","slug":"proform-enterprise-county-lookup-table-updates","status":"publish","type":"post","link":"https:\/\/danvanfleet.com\/index.php\/proform-enterprise-county-lookup-table-updates\/","title":{"rendered":"ProForm Enterprise County Lookup Table updates"},"content":{"rendered":"<p>Today a client asked if we could add $7.00 to the first page of all Mortgage Recording fees in the state of California.&nbsp; There are 58 counties in California, some of them have multiple entries for varying costs. <\/p>\n<p><!--more--><\/p>\n<p>Doing this sort of update manually is a huge pain.&nbsp; There are a number of different ways to mass update data in the lookup tables.&nbsp; I&#8217;m not a fan of using ODBC connections in Excel or Access to update lookup tables, there are slight differences in data formats which can cause information to disappear during the update.&nbsp; So it&#8217;s SQL Server Management Studio to the rescue.<\/p>\n<p>The only catch with using SQLSMS to do the update is the data is stored as a nvarchar() format, which is all good, but viewed as a string rather than a decimal.&nbsp; So a conversion of the data in the column needs to take place during the update.<\/p>\n<p>In this client&#8217;s case (and many others) the column that needs updated is called &#8220;Mortgage_Cost&#8221;.&nbsp; ProForm uses a translation table to connect Fields to database columns.&nbsp; To find the correct column name first it&#8217;s necessary to find the field name that needs updated.&nbsp; In this case it&#8217;s MTRTE1 visible on the 1200 formula screen.&nbsp; Next bring up the lookup table and Modify Table, to show the Create\/Edit Lookup Table screen<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/danvanfleet.com\/wp-content\/uploads\/2013\/02\/image.png\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" style=\"border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/i0.wp.com\/danvanfleet.com\/wp-content\/uploads\/2013\/02\/image_thumb.png?resize=400%2C278\" width=\"400\" height=\"278\"><\/a> <\/p>\n<p>Find the field in question and notate the the value to the right of the equal sign, that is the column header in the table.&nbsp; The Table name itself is listed at the bottom of the screen.<\/p>\n<p>For this update, the table name is County, and the Column name is Mortgage_Cost.&nbsp; let&#8217;s make the SQL statement that will update the table.<\/p>\n<div id=\"codeSnippetWrapper\">\n<div style=\"border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px\" id=\"codeSnippet\">\n<pre style=\"border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px\"><span style=\"color: #0000ff\">UPDATE<\/span> [ProFormLookups].[dbo].[COUNTY]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px\">   <span style=\"color: #0000ff\">SET<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px\">      [Mortgage_Cost] =  (<span style=\"color: #0000ff\">Cast<\/span>(Mortgage_Cost <span style=\"color: #0000ff\">as<\/span> <span style=\"color: #0000ff\">Decimal<\/span>) + 7.00)<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px\"> <span style=\"color: #0000ff\">WHERE<\/span> <span style=\"color: #0000ff\">STATE<\/span> = <span style=\"color: #006080\">'CA'<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px\">GO<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Click the Execute button and the table will be updated.&nbsp; Now I highly recommend doing this on a test table before doing it on your live data, make sure you know precisely what the command is going to do prior to going live.<\/p>\n<p>Notice that even though we are adding an even $7, there are 2 decimal places used.&nbsp; ProForm likes to see 2 decimal places and by using &#8220;7.00&#8221; rather than &#8220;7&#8221; we maintain those 2 places.<\/p>\n<p>If you fail to use the Cast as Decimal SQL will concatenate the strings together putting something like &#8220;40.007.00&#8221;&nbsp; in the field, which of course will not evaluate in ProForm properly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today a client asked if we could add $7.00 to the first page of all Mortgage Recording fees in the state of California.&nbsp; There are 58 counties in California, some of them have multiple entries for varying costs.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[23],"tags":[28,21],"class_list":["post-389","post","type-post","status-publish","format-standard","hentry","category-softpro-2","tag-lookup","tag-proform","entry"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4wyVb-6h","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/posts\/389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/comments?post=389"}],"version-history":[{"count":2,"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/posts\/389\/revisions"}],"predecessor-version":[{"id":508,"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/posts\/389\/revisions\/508"}],"wp:attachment":[{"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/media?parent=389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/categories?post=389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/tags?post=389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}