<?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 Re: Convert VB SCripts to Python in ArcMap Questions</title>
    <link>https://community.esri.com/t5/arcmap-questions/convert-vb-scripts-to-python/m-p/1137138#M3369</link>
    <description>&lt;LI-CODE lang="python"&gt;def some_func(arg0, arg1):
    if arg0 = "UWNY":
        out = f"path1\{arg1}\.pdf"
    elif arg0 = "O&amp;amp;R":
        out = f"path2\{arg1}\.pdf"
    else:
        out = f"path3\{arg1}\.pdf"
    return out
# usage expression
# some_func(!first_field!, !second_field!)&lt;/LI-CODE&gt;&lt;P&gt;change path1, path2 and path3 in the script to your long ones&lt;/P&gt;&lt;P&gt;Call it using a "code_block" with the expression, line 10, set up for a python parser substituting your field names in for those in the expression... don't omit the ! ! marks&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jan 2022 21:53:38 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2022-01-25T21:53:38Z</dc:date>
    <item>
      <title>Convert VB SCripts to Python</title>
      <link>https://community.esri.com/t5/arcmap-questions/convert-vb-scripts-to-python/m-p/1137108#M3367</link>
      <description>&lt;P&gt;&lt;STRONG&gt;New to Python. Here is the code thatwork in vb scripts.&amp;nbsp; how to make it work in python&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If [APPLICANT] = "UWNY" Then&lt;/P&gt;&lt;P&gt;Attachment = "G:\highway_Permits\Road_Permits\Road Permits Issued\Road_Permits_Suez_PDF_Scans\"+ [PERMIT_NO] +".pdf"&lt;/P&gt;&lt;P&gt;ElseIf [APPLICANT] = "O&amp;amp;R" Then&lt;/P&gt;&lt;P&gt;Attachment = "G:\highway_Permits\Road_Permits\Road Permits Issued\Road_Permits_OnR_PDF_Scans\"+ [PERMIT_NO] +".pdf"&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt;Attachment = "G:\highway_Permits\Road_Permits\Road Permits Issued\Roads_Permits_Others_PDF_Scans\"+ [PERMIT_NO] +".pdf"&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 21:17:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/convert-vb-scripts-to-python/m-p/1137108#M3367</guid>
      <dc:creator>Kok_MengPng</dc:creator>
      <dc:date>2022-01-25T21:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Convert VB SCripts to Python</title>
      <link>https://community.esri.com/t5/arcmap-questions/convert-vb-scripts-to-python/m-p/1137126#M3368</link>
      <description>&lt;P&gt;If you're new to Python, it's probably best if you do a bit to understand how it works before asking someone to convert your VB scripts.&lt;/P&gt;&lt;P&gt;The best way to learn (apart from reading the documentation) is to just start trying things out. I would suggest setting up Jupyter Notebooks or JupyterLab, as they are excellent for fiddling around and testing things out.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 21:36:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/convert-vb-scripts-to-python/m-p/1137126#M3368</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-01-25T21:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convert VB SCripts to Python</title>
      <link>https://community.esri.com/t5/arcmap-questions/convert-vb-scripts-to-python/m-p/1137138#M3369</link>
      <description>&lt;LI-CODE lang="python"&gt;def some_func(arg0, arg1):
    if arg0 = "UWNY":
        out = f"path1\{arg1}\.pdf"
    elif arg0 = "O&amp;amp;R":
        out = f"path2\{arg1}\.pdf"
    else:
        out = f"path3\{arg1}\.pdf"
    return out
# usage expression
# some_func(!first_field!, !second_field!)&lt;/LI-CODE&gt;&lt;P&gt;change path1, path2 and path3 in the script to your long ones&lt;/P&gt;&lt;P&gt;Call it using a "code_block" with the expression, line 10, set up for a python parser substituting your field names in for those in the expression... don't omit the ! ! marks&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 21:53:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/convert-vb-scripts-to-python/m-p/1137138#M3369</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-01-25T21:53:38Z</dc:date>
    </item>
  </channel>
</rss>

