<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Convert VB Expression to Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/convert-vb-expression-to-python/m-p/643097#M50151</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had an expression written in VB before upgrading to Pro. It seems that Pro does not support VB. I am having to convert the below to Python 3 in a new model but I just can't get it to work...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to grab a value in a field (PIPE_COND_SCORE) and multiply it by a value in a variable (PIPE_COND_WEIGHT) and insert the resulting value into a new field called TOTAL_SCORE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/461550_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The old VB is below and this was working in Desktop 10.3, for the sake of testing I have only added the first variable to the new model at this stage):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;([PIPE_COND_SCORE] * %PIPE_COND_WEIGHT%) + ([PLACE_DATE_SCORE] * %PLACE_DATE_WEIGHT%) + ([WATERWAY_SCORE] * %WATERWAYS_WEIGHT%) + ([PRIORITY_AREA_SCORE] * %PRIORITY_AREA_WEIGHT%) + ([RCODE_SCORE] * %RDCODES_WEIGHT%) + ([BUILD_FOOT_SCORE] * %BUILD_FOOT_WEIGHT%) + ([ROAD_CENTRELINE] * %ROAD_CL_WEIGHT%) + ([PATH_CENTRELINE] * %PATH_CL_WEIGHT%) + ([PIPE_DIA_SCORE] * %PIPE_DIA_WEIGHT%) + ([COA_BUILDING_SCORE] * %COA_BUILD_WEIGHT%) + ([KNOWN_MAINT_SCORE] * %KNOWN_MAINT_WEIGHT%)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From my research the expression should look something like this (using just the PIPE_COND_SCORE as example):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;!PIPE_COND_SCORE! * %PIPE_COND_WEIGHT%&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above expression seems to call up the field correctly. The issue seems to be the calling up of the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Oct 2019 00:34:23 GMT</pubDate>
    <dc:creator>RobertWesterberg</dc:creator>
    <dc:date>2019-10-10T00:34:23Z</dc:date>
    <item>
      <title>Convert VB Expression to Python</title>
      <link>https://community.esri.com/t5/python-questions/convert-vb-expression-to-python/m-p/643097#M50151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had an expression written in VB before upgrading to Pro. It seems that Pro does not support VB. I am having to convert the below to Python 3 in a new model but I just can't get it to work...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to grab a value in a field (PIPE_COND_SCORE) and multiply it by a value in a variable (PIPE_COND_WEIGHT) and insert the resulting value into a new field called TOTAL_SCORE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/461550_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The old VB is below and this was working in Desktop 10.3, for the sake of testing I have only added the first variable to the new model at this stage):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;([PIPE_COND_SCORE] * %PIPE_COND_WEIGHT%) + ([PLACE_DATE_SCORE] * %PLACE_DATE_WEIGHT%) + ([WATERWAY_SCORE] * %WATERWAYS_WEIGHT%) + ([PRIORITY_AREA_SCORE] * %PRIORITY_AREA_WEIGHT%) + ([RCODE_SCORE] * %RDCODES_WEIGHT%) + ([BUILD_FOOT_SCORE] * %BUILD_FOOT_WEIGHT%) + ([ROAD_CENTRELINE] * %ROAD_CL_WEIGHT%) + ([PATH_CENTRELINE] * %PATH_CL_WEIGHT%) + ([PIPE_DIA_SCORE] * %PIPE_DIA_WEIGHT%) + ([COA_BUILDING_SCORE] * %COA_BUILD_WEIGHT%) + ([KNOWN_MAINT_SCORE] * %KNOWN_MAINT_WEIGHT%)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From my research the expression should look something like this (using just the PIPE_COND_SCORE as example):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;!PIPE_COND_SCORE! * %PIPE_COND_WEIGHT%&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above expression seems to call up the field correctly. The issue seems to be the calling up of the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2019 00:34:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-vb-expression-to-python/m-p/643097#M50151</guid>
      <dc:creator>RobertWesterberg</dc:creator>
      <dc:date>2019-10-10T00:34:23Z</dc:date>
    </item>
  </channel>
</rss>

