<?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 Function, data types (integer, string), for loop in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Function-data-types-integer-string-for-loop/m-p/6122#M1342</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a function that creates a comma-separated list of hostnames which is used as a parameter for and NFS export create command. It works with one exception. It is very short and easy to show it working, and failing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;==== begin-snip ====&lt;/P&gt;&lt;P&gt;def oraExportList( env, clnm, first, last, iface) &lt;/P&gt;&lt;P&gt;{ &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exportList = ""; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hostPfx = "xlp";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for ( int i =&amp;nbsp; first; i &amp;lt;= last; i++ ) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exportList = exportList + hostPfx + clnm + padNumber(i,2) + "-" + iface + "," ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return exportList.substring(0,exportList.length()-1); // trims last character (comma at end-of-line)&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;==== end-snip ====&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hitting the [Test] button and providing the expression ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;oraExportList("dev","odb",5,"08","sp132")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;... works as expected. It iterates from 5 thru 8 and creates a list of formatted hostnames as desired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;xlpodb05-sp132,xlpodb06-sp132,xlpodb07-sp132,xlpodb08-sp132&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HOWEVER, I need the function to accept string parameters. Even thou first and last are used as integer values by the function I need to pass them as strings. Note that the 3rd parameter, named 'first' is passed as: 5 without quotes which is what I would call an integer being passed. The functions starts its simple for-loop by setting &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;i = first and continuing while i &amp;lt;= last. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;What I need is for the function to work with this expression ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;oraExportList("dev","odb","05","08","sp132")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I call it with first as a string it runs error free but only iterates through the loop 1 time and returns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;xlpodb05-sp132&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I've tried to explicitly convert first and last to integers with something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int begin = first;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int end = last; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for ( int i =&amp;nbsp; begin; i &amp;lt;= end; i++ )) { ... }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;But no luck. Six-pack of beer to whoever can advise what is going on here. (NOTE: suggesting I write this in PowerShell is not appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jun 2025 05:31:43 GMT</pubDate>
    <dc:creator>korns</dc:creator>
    <dc:date>2025-06-05T05:31:43Z</dc:date>
    <item>
      <title>Function, data types (integer, string), for loop</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Function-data-types-integer-string-for-loop/m-p/6122#M1342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a function that creates a comma-separated list of hostnames which is used as a parameter for and NFS export create command. It works with one exception. It is very short and easy to show it working, and failing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;==== begin-snip ====&lt;/P&gt;&lt;P&gt;def oraExportList( env, clnm, first, last, iface) &lt;/P&gt;&lt;P&gt;{ &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exportList = ""; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hostPfx = "xlp";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for ( int i =&amp;nbsp; first; i &amp;lt;= last; i++ ) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exportList = exportList + hostPfx + clnm + padNumber(i,2) + "-" + iface + "," ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return exportList.substring(0,exportList.length()-1); // trims last character (comma at end-of-line)&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;==== end-snip ====&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hitting the [Test] button and providing the expression ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;oraExportList("dev","odb",5,"08","sp132")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;... works as expected. It iterates from 5 thru 8 and creates a list of formatted hostnames as desired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;xlpodb05-sp132,xlpodb06-sp132,xlpodb07-sp132,xlpodb08-sp132&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HOWEVER, I need the function to accept string parameters. Even thou first and last are used as integer values by the function I need to pass them as strings. Note that the 3rd parameter, named 'first' is passed as: 5 without quotes which is what I would call an integer being passed. The functions starts its simple for-loop by setting &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;i = first and continuing while i &amp;lt;= last. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;What I need is for the function to work with this expression ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;oraExportList("dev","odb","05","08","sp132")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I call it with first as a string it runs error free but only iterates through the loop 1 time and returns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;xlpodb05-sp132&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I've tried to explicitly convert first and last to integers with something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int begin = first;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int end = last; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for ( int i =&amp;nbsp; begin; i &amp;lt;= end; i++ )) { ... }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;But no luck. Six-pack of beer to whoever can advise what is going on here. (NOTE: suggesting I write this in PowerShell is not appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2025 05:31:43 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Function-data-types-integer-string-for-loop/m-p/6122#M1342</guid>
      <dc:creator>korns</dc:creator>
      <dc:date>2025-06-05T05:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Function, data types (integer, string), for loop</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Function-data-types-integer-string-for-loop/m-p/6126#M1343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can type-cast MVEL like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first = (int) first;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and it will work fine:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12.727272033691406px; background-color: #ffffff;"&gt;==== begin-snip ====&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;def oraExportList( env, clnm, first, last, iface) &lt;/P&gt;&lt;P&gt;{ &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exportList = ""; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hostPfx = "xlp";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #008000;"&gt; first = (int) first;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for ( int i =&amp;nbsp; first; i &amp;lt;= last; i++ ) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exportList = exportList + hostPfx + clnm + padNumber(i,2) + "-" + iface + "," ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return exportList.substring(0,exportList.length()-1); // trims last character (comma at end-of-line)&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;====end-snip===&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://community.netapp.com/legacyfs/online/26443_function_krons.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12.727272033691406px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 03:30:09 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Function-data-types-integer-string-for-loop/m-p/6126#M1343</guid>
      <dc:creator>sinhaa</dc:creator>
      <dc:date>2014-07-30T03:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Function, data types (integer, string), for loop</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Function-data-types-integer-string-for-loop/m-p/6135#M1344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome! Thank you SInhaa. I knew it had something to do with "type" but I was mistakenly trying things like "first = [int] first" which is more like PowerShell typing syntax. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 14:13:40 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Function-data-types-integer-string-for-loop/m-p/6135#M1344</guid>
      <dc:creator>korns</dc:creator>
      <dc:date>2014-07-30T14:13:40Z</dc:date>
    </item>
  </channel>
</rss>

