<?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: Modelbuilder Calculate Value only returns a &amp;quot;1&amp;quot; in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381267#M78654</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/470079"&gt;@EMiller_2&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Without knowing what the string looks like, it could be that the code is not set properly or there are other characters in the string that is preventing the character replacements. An option to fix this is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;"""Expression"""
Expression = NewString( Field or Value )

"""Code Block"""
def NewString( InsertString ):
    New = None
    if type( InsertString ) != str: pass
    else:
        if ',' in InsertString: 
            New = InsertString.split( ',' )
            New = '_'.join( New )
        else: pass
    if New: return New
    else: return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Feb 2024 20:21:14 GMT</pubDate>
    <dc:creator>RPGIS</dc:creator>
    <dc:date>2024-02-12T20:21:14Z</dc:date>
    <item>
      <title>Modelbuilder Calculate Value only returns a "1"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381248#M78653</link>
      <description>&lt;P&gt;I'm missing something very basic here. I'm using Modelbuilder in ArcGIS Pro 2.9.5 and I'm using the Calculate Value tool to do a simple task of removing spaces from a name string, which I then want to pass on to a Make Table View tool as the name of the output file.&lt;/P&gt;&lt;P&gt;I'm entering an Expression in the Calculate Value tool and I'm leaving the Code Block blank. Name is a precondition. Output data type is String. I have made Value a Parameter. The output "Value" reads as expected in the code comments after the tool has run but when I try to use %Value% in the Make Table View Tool it always reads the output as a "1" so my output table is always named "1."&lt;/P&gt;&lt;P&gt;What am I missing? Why is Value "1" and not the string I am building in the expression?&lt;/P&gt;&lt;P&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="calcvalue1.PNG" style="width: 381px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94519i8648AC2223A652A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="calcvalue1.PNG" alt="calcvalue1.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="calcvalue2.PNG" style="width: 289px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94525iAB8D3B83A891310E/image-size/large?v=v2&amp;amp;px=999" role="button" title="calcvalue2.PNG" alt="calcvalue2.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 19:57:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381248#M78653</guid>
      <dc:creator>EMiller_2</dc:creator>
      <dc:date>2024-02-12T19:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Modelbuilder Calculate Value only returns a "1"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381267#M78654</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/470079"&gt;@EMiller_2&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Without knowing what the string looks like, it could be that the code is not set properly or there are other characters in the string that is preventing the character replacements. An option to fix this is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;"""Expression"""
Expression = NewString( Field or Value )

"""Code Block"""
def NewString( InsertString ):
    New = None
    if type( InsertString ) != str: pass
    else:
        if ',' in InsertString: 
            New = InsertString.split( ',' )
            New = '_'.join( New )
        else: pass
    if New: return New
    else: return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 20:21:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381267#M78654</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2024-02-12T20:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Modelbuilder Calculate Value only returns a "1"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381303#M78661</link>
      <description>&lt;P&gt;Have you tried to run the tool yet?&amp;nbsp; My first guess is it's just defaulting to 1 as it doesn't know the input or output.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 20:55:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381303#M78661</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2024-02-12T20:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Modelbuilder Calculate Value only returns a "1"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381318#M78667</link>
      <description>&lt;P&gt;Thank you RPGIS,&lt;/P&gt;&lt;P&gt;The problem is not the code doing the conversion -- it appears to be how to pass on the result as a Value.&lt;/P&gt;&lt;P&gt;In the case of my code example shown above, I achieve the proper result, as you see here (below -- "John Smith" becomes "John_Smith"). But the Value in the green oval still reads as a 1.&lt;/P&gt;&lt;P&gt;Unfortunately my attempt to use your code example did run for me but resulted in no Value and also a 1 in the green result oval! (see last image).&lt;BR /&gt;&lt;BR /&gt;I do appreciate your help.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="calcvalue3.PNG" style="width: 253px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94543i361AD2B8281195FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="calcvalue3.PNG" alt="calcvalue3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="calcvalue5.PNG" style="width: 450px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94541iD11EAC543D4037A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="calcvalue5.PNG" alt="calcvalue5.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="calcvalue4.PNG" style="width: 440px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94544i6175CD6320D85FA1/image-size/large?v=v2&amp;amp;px=999" role="button" title="calcvalue4.PNG" alt="calcvalue4.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 21:19:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381318#M78667</guid>
      <dc:creator>EMiller_2</dc:creator>
      <dc:date>2024-02-12T21:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Modelbuilder Calculate Value only returns a "1"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381822#M78712</link>
      <description>&lt;P&gt;I've run it every way I can think of, and the output is always "1" and not the string I am hoping to use in the next tool (Make Table View).&lt;BR /&gt;&lt;BR /&gt;What I would like to do is use the variable "%Value%" in the next tool as part of the name of the output file, but what I get is an output file named "1"!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 19:51:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1381822#M78712</guid>
      <dc:creator>EMiller_2</dc:creator>
      <dc:date>2024-02-13T19:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Modelbuilder Calculate Value only returns a "1"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1383628#M79007</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;Your analysis is correct in that the tool is not receiving/recognizing the input I am trying to give it, so it appears that it always returns a "1." That is the short answer! I will leave it there for now. Thank you to all for the help.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 21:01:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/modelbuilder-calculate-value-only-returns-a-quot-1/m-p/1383628#M79007</guid>
      <dc:creator>EMiller_2</dc:creator>
      <dc:date>2024-02-16T21:01:55Z</dc:date>
    </item>
  </channel>
</rss>

