{"id":1195,"date":"2015-08-17T15:59:50","date_gmt":"2015-08-17T20:59:50","guid":{"rendered":"https:\/\/danvanfleet.com\/?p=1195"},"modified":"2015-08-18T11:44:57","modified_gmt":"2015-08-18T16:44:57","slug":"select-ironpython-coolness","status":"publish","type":"post","link":"https:\/\/danvanfleet.com\/index.php\/select-ironpython-coolness\/","title":{"rendered":"Select IronPython coolness"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/danvanfleet.com\/wp-content\/uploads\/2015\/08\/FePython.png\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignleft  wp-image-1203\" src=\"https:\/\/i0.wp.com\/danvanfleet.com\/wp-content\/uploads\/2015\/08\/FePython-300x287.png?resize=189%2C181\" alt=\"FePython image\" width=\"189\" height=\"181\" srcset=\"https:\/\/i0.wp.com\/danvanfleet.com\/wp-content\/uploads\/2015\/08\/FePython.png?w=300&amp;ssl=1 300w, https:\/\/i0.wp.com\/danvanfleet.com\/wp-content\/uploads\/2015\/08\/FePython.png?resize=150%2C144&amp;ssl=1 150w\" sizes=\"(max-width: 189px) 100vw, 189px\" \/><\/a>Every time I work with it, I love IronPython in Select, it is clearly a replacement for most of what happens in formulas. I wrote an introductory\u00a0<a href=\"https:\/\/danvanfleet.com\/\">piece<\/a> a few months back. I then took the concept of Document Formatting Options, like <strong>LD<\/strong> and <strong>LDR<\/strong> to control how date fields render to\u00a0built an IronPython module that emulates most of the Document Formatting Options available. I added a couple more like Pad left or right with any\u00a0character.<\/p>\n<p>If you or someone you know is interested in learning about IronPython this tool would be an excellent starter for setting system default values.\u00a0 It provides an easy way to create automated legal descriptions, mortgage clauses, or any other text based field. It handles formatting of data allowing the developer to easily add information. The entire set is over 500 lines of code and includes examples of automating the values for escrow brief legal and existing liens.\u00a0 At the end of this article, I\u2019ll include the output from the test tool. The test tool is also included in the package as a source of examples.<\/p>\n<p><!--more--><\/p>\n<p>&nbsp;<\/p>\n<h3>Why it\u2019s cool<\/h3>\n<p>As an example the formula to create our Escrow Brief Legal is in excess of 150 lines. In IronPython using this tool a developer defines 16 lines. Controlling the output in that few lines is both easy and quick. Making it run is simple.<\/p>\n<h4>Come along for the ride<\/h4>\n<p>So thinking about the legal description we\u00a0start with Lots or Units. To do that with this tool takes\u00a02 lines of code that intelligently deals with plurals for multiples. \u00a0That looks like this:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nAddObjectNumber(sb, args.Context.Lots, 'Lot ', 'Lots ', ' ' , ', ')\r\nAddObjectNumber(sb, args.Context.Units, 'Unit ', 'Units ', ' ' , ', ')\r\n<\/pre>\n<p>Both Lots and Units have a child item called Number, so we call a tool function named\u00a0<strong>AddObjectNumber.<\/strong><\/p>\n<p>The parameters are,<\/p>\n<p style=\"padding-left: 30px;\">sb is a required variable, our final text and previously setup with sb = StringBuilder().<\/p>\n<p style=\"padding-left: 60px;\">Slight digression here, StringBuilder should be used for most text manipulation in IronPython, include &#8220;<strong>from System.Text import StringBuilder<\/strong>&#8220;<\/p>\n<p style=\"padding-left: 30px;\">Second we send in the multiple that is to be processed. (args.Context .Lots or .Units)<\/p>\n<p style=\"padding-left: 30px;\">Third is the text that should appear if there is one item.<\/p>\n<p style=\"padding-left: 30px;\">Fourth is the multiple item text.<\/p>\n<p style=\"padding-left: 30px;\">Fifth is the string to appear after all multiples are dealt with.<\/p>\n<p style=\"padding-left: 30px;\">Last is the separator string. In this case comma space.<\/p>\n<p>Those last 2 are in reverse order, I might have to change that. <strong>If there are no Lots or Units nothing is added to sb.<\/strong><\/p>\n<p>Continuing on with our Legal Description, Block and Building are next which are a little simpler to add<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nAddTextSingle(sb, args.Context.Block, 'Block ', ' ' )\r\nAddTextSingle(sb, args.Context.Building, 'Building ' , ' ' )\r\n<\/pre>\n<p>The first 2 parameters are the same, followed by the text to put before, then after the value of Block or Building if one exists.<\/p>\n<p>The next section is interesting, if there is a subdivision, then if there is a Block, we want the Block\u00a0on a new line. This requires a little more code to determine if there was a subdivision.<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\npreSubdivision = sb.Length #Save current length\r\nAddTextSingle(sb, args.Context.Subdivision, '\\r\\n', ' ')\r\n<\/pre>\n<p>First we save the length of our text string to compare it after we add Subdivision.<\/p>\n<p>Next using the same <strong>AddTextSingle<\/strong> that Block used, we add the subdivision.<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nif preSubdivision == sb.Length:\r\n#Length didn't grow, put Condo on separate line\r\n   AddTextSingle(sb, args.Context.Condo, '\\r\\n', ' ')\r\nelse:\r\n   AddTextSingle(sb, args.Context.Condo, '', ' ')\r\n\r\n<\/pre>\n<p>Now we compare our lengths, if something was added use the same <strong>AddTextSingle<\/strong> function putting a carriage return linefeed before the Condo. Otherwise, just add the Condo.<\/p>\n<p>The demo legal description continues with putting a Section on a new line if it exists, and adding a Phase.<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nAddTextSingle(sb, args.Context.Section, '\\r\\nSection ', ' ')\r\nAddTextSingle(sb, args.Context.Phase, 'Phase ' , ' ' )\r\n<\/pre>\n<p>Finally using a function like Block and Units called <strong>AddObjectIdentification<\/strong> add Parcel ID&#8217;s and or Tax Map Id&#8217;s each on their own new line.<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nAddObjectIdentification(sb, args.Context.Parcels, '\\r\\nParcel ID ','\\r\\nParcel IDs ', ' ' , ', ')\r\nAddObjectIdentification(sb, args.Context.TaxMaps, '\\r\\nTax\/Map ID ','\\r\\nTax\/Map IDs ', ' ' , ', ')\r\n<\/pre>\n<p>Finally set the value of the field<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nargs.Value = sb.ToString()\r\n<\/pre>\n<h4>Easy updates and changes<\/h4>\n<p>Moving things around is simple, just move a few lines about in the short function. So to put Building before Block it is a simple edit.<\/p>\n<p>Change this<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nAddTextSingle(sb, args.Context.Block, 'Block ', ' ' )\r\nAddTextSingle(sb, args.Context.Building, 'Building ' , ' ' )\r\n<\/pre>\n<p>To this<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nAddTextSingle(sb, args.Context.Building, 'Building ' , ' ' )\r\nAddTextSingle(sb, args.Context.Block, 'Block ', ' ' )\r\n<\/pre>\n<p>And Building will appear before Block in the final rendered field.<\/p>\n<p>So that&#8217;s how to build a brief legal description in Select that is quick to build and easy to manage.<\/p>\n<h4>Other Field types<\/h4>\n<p>Date Fields are handled in a similar fashion Add a regular date field with<\/p>\n<p>AddDateSD(sb, field, pre, post)<\/p>\n<p>That will render 08\/17\/15<\/p>\n<p>The parameters are the same as AddTextSingle<\/p>\n<p>AddDateLDW renders &#8211;\u00a0 Wednesday, June 03, 2015<\/p>\n<p>AddDateLDWS renders &#8211;\u00a0 Wednesday, June 3, 2015<\/p>\n<p>Or you can use AddDateLDR which renders &#8211;\u00a0 3rd day of June, 2015<\/p>\n<p>There are number formatters for Currency and decimal places as well as functions that will enter underscores if no text exists.<\/p>\n<p>Clearly there is a lot more with IronPython in Select, these tools\u00a0allow a wider audience of developers or technicians to build IronPython modules for Select users.<\/p>\n<p>Everything that is included is shown below. This output was created by a test module and includes more valuable examples of some of what can be done with IronPython in Select. It was formatted for display.<\/p>\n<h4>Demo output of test tool<\/h4>\n<p>DVF Value Tools Test and IronPython Demo<\/p>\n<p>Most of the Document Formatting Options are duplicated in this module.\u00a0 New thoughts are added<\/p>\n<p>During usage Data Type is important if a string is tossed to a number or date function it will error<\/p>\n<p>Parameter Information<\/p>\n<p>sb is the stringBuilder where the final output is built<\/p>\n<p>field changes during the operation<\/p>\n<p>The variable pre is set to a space, post is set to line feed<\/p>\n<p>Objects or Contexts which have a Number child are labelled for single or multiple, with everything definable in the call<\/p>\n<p>AddObjectNumber(sb, args.Context.Lots, Lot, Lots, commaSpace, space) renders &#8211; Lots 7665, 334<\/p>\n<p>Identification style Contexts are handled the same way<\/p>\n<p>AddObjectIdentification(sb, args.Context.Parcels, single, multiple, betweenMultiples, afterLabel) renders &#8211; Parcel ID 34-445-1233<\/p>\n<p>field changed to PersonalProperty Amount<\/p>\n<p>AddCurrency(sb, field, pre, post) renders &#8211;\u00a0 $543,111.23<\/p>\n<p>AddNumberNoComma(sb, field, pre, post) renders &#8211;\u00a0 543111.23<\/p>\n<p>AddNumber2(sb, field, pre, post) renders &#8211;\u00a0 543,111.23<\/p>\n<p>AddNumber5(sb, field, pre, post) renders &#8211;\u00a0 543,111.23000<\/p>\n<p>field changed to ParkingSpaces<\/p>\n<p>AddTextSingle(sb, field, pre, post) renders &#8211;\u00a0 Parking Spaces<\/p>\n<p>AddTextFill(sb, field, pre, post, size=22) renders &#8211;\u00a0 ********Parking Spaces<\/p>\n<p>AddTextLeftPad(sb, field, pre, post, size=25, pad=.) renders &#8211;\u00a0 &#8230;&#8230;&#8230;..Parking Spaces<\/p>\n<p>AddTextRightPad(sb, field, pre, post, size=20, pad=#) renders &#8211;\u00a0 Parking Spaces######<\/p>\n<p>AddTextBlankLine(sb, field, pre, post, numberUnderscore = 32) renders &#8211;\u00a0 Parking Spaces<\/p>\n<p>AddTextNA(sb, field, pre, post) renders &#8211;\u00a0 Parking Spaces<\/p>\n<p>field changed to Condo which is empty to test Empty Conditions on the above 2<\/p>\n<p>AddTextBlankLine(sb, field, pre, post, numberUnderscore=35) renders &#8211;\u00a0 ___________________________________<\/p>\n<p>AddTextNA(sb, field, pre, post) renders &#8211;\u00a0 N\/A<\/p>\n<p>field changed to ParkingSpaces<\/p>\n<p>AddTextLC(sb, field, pre, post) renders &#8211;\u00a0 parking spaces<\/p>\n<p>AddTextUC(sb, field, pre, post) renders &#8211;\u00a0 PARKING SPACES<\/p>\n<p>field changed to MapReferenceRecording RecordedDate<\/p>\n<p>AddDateSD(sb, field, pre, post) renders &#8211;\u00a0 06\/03\/15<\/p>\n<p>AddDateSD4(sb, field, pre, post) renders &#8211;\u00a0 06\/03\/2015<\/p>\n<p>AddDateLD(sb, field, pre, post) renders &#8211;\u00a0 June 03, 2015<\/p>\n<p>AddDateLDS(sb, field, pre, post) renders &#8211;\u00a0 June 3, 2015<\/p>\n<p>AddDateLDT(sb, field, pre, post) renders &#8211;\u00a0 June 03rd, 2015<\/p>\n<p>AddDateLDTS(sb, field, pre, post) renders &#8211;\u00a0 June 3rd, 2015<\/p>\n<p>AddDateLDW(sb, field, pre, post) renders &#8211;\u00a0 Wednesday, June 03, 2015<\/p>\n<p>AddDateLDWS(sb, field, pre, post) renders &#8211;\u00a0 Wednesday, June 3, 2015<\/p>\n<p>AddDateLDR(sb, field, pre, post) renders &#8211;\u00a0 3rd day of June, 2015<\/p>\n<p>AddDateMNAME(sb, field, pre, post) renders &#8211;\u00a0 June<\/p>\n<p>AddDateM(sb, field, pre, post) renders &#8211;\u00a0 6<\/p>\n<p>AddDateMM(sb, field, pre, post) renders &#8211;\u00a0 06<\/p>\n<p>AddDateMT(sb, field, pre, post) renders &#8211;\u00a0 6th<\/p>\n<p>AddDateDT(sb, field, pre, post) renders &#8211;\u00a0 3rd<\/p>\n<p>AddDateD(sb, field, pre, post) renders &#8211;\u00a0 3<\/p>\n<p>AddDateDD(sb, field, pre, post) renders &#8211;\u00a0 03<\/p>\n<p>AddDateYY(sb, field, pre, post) renders &#8211;\u00a0 15<\/p>\n<p>AddDateYYYY(sb, field, pre, post) renders &#8211;\u00a0 2015<\/p>\n<p>AddDateWD(sb, field, pre, post) renders &#8211;\u00a0 Wednesday<\/p>\n<p>AddDateT(sb, field, pre, post) renders &#8211;\u00a0 9:05 AM<\/p>\n<p>AddDateTS(sb, field, pre, post) renders &#8211;\u00a0 9:05:00 AM<\/p>\n<p>AddDateT24(sb, field, pre, post) renders &#8211;\u00a0 9:05<\/p>\n<p>AddDateTS24(sb, field, pre, post) renders &#8211;\u00a0 9:05:00<\/p>\n<p>AddDateH(sb, field, pre, post) renders &#8211;\u00a0 9<\/p>\n<p>AddDateHH(sb, field, pre, post) renders &#8211;\u00a0 09<\/p>\n<p>AddDateH24(sb, field, pre, post) renders &#8211;\u00a0 9<\/p>\n<p>AddDateHH24(sb, field, pre, post) renders &#8211;\u00a0 09<\/p>\n<p>AddDateMIN(sb, field, pre, post) renders &#8211;\u00a0 05<\/p>\n<p>AddDateSec(sb, field, pre, post) renders &#8211;\u00a0 00<\/p>\n<p>AddDateAMPM(sb, field, pre, post) renders &#8211;\u00a0 AM<\/p>\n<p>So have you played with IronPython in Select?<\/p>\n<h3>Price<\/h3>\n<p>Pricing is based on installation locations, for the typical agent with 5 or fewer office locations the cost is $150.00. \u00a0For larger installations contact sales at\u00a0937-424-5734 to discuss options.<\/p>\n<p>Full distribution rights for this code tool are also available, contact sales for more information.<\/p>\n<p>I\u2019m also available for one on one training sessions at a reasonable fee.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Every time I work with it, I love IronPython in Select, it is clearly a replacement for most of what happens in formulas. I wrote an introductory\u00a0piece a few months back. I then took the concept of Document Formatting Options, like LD and LDR to control how date fields render to\u00a0built an IronPython module that [&hellip;]<\/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":true,"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":[39],"class_list":["post-1195","post","type-post","status-publish","format-standard","hentry","category-softpro-2","tag-select","entry"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4wyVb-jh","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/posts\/1195","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=1195"}],"version-history":[{"count":15,"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/posts\/1195\/revisions"}],"predecessor-version":[{"id":1212,"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/posts\/1195\/revisions\/1212"}],"wp:attachment":[{"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/media?parent=1195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/categories?post=1195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/danvanfleet.com\/index.php\/wp-json\/wp\/v2\/tags?post=1195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}