<?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: Retrieving parameter value with parameter name as string in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Retrieving-parameter-value-with-parameter-name-as-string/m-p/288854#M8095</link>
    <description>Matrices are your friend in this situation. You can't use a loop to create a variable name (as you can in other languages), but you can populate and query / test the contents of a matrix.&lt;BR /&gt;
&lt;BR /&gt;
DIM arrayName[] is how you declare (or DIM arrayName[][] for a 2-dimension array)&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps.</description>
    <pubDate>Fri, 03 Jun 2016 07:30:26 GMT</pubDate>
    <dc:creator>Bruce</dc:creator>
    <dc:date>2016-06-03T07:30:26Z</dc:date>
    <item>
      <title>Retrieving parameter value with parameter name as string</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Retrieving-parameter-value-with-parameter-name-as-string/m-p/288853#M8094</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;I am trying to use a string as a parameter reference:&lt;BR /&gt;
&lt;BR /&gt;
I have a parameter called &lt;PRE&gt;param_1&lt;/PRE&gt; which is a boolean variable&lt;BR /&gt;
I then generate the parameter name in a loop&lt;BR /&gt;
ie.&lt;BR /&gt;

&lt;PRE&gt;	
i = 0
FOR i=1 TO 6 STEP 1
	mystring = 'param_' + str(i,1,0)
NEXT i
&lt;/PRE&gt;
I then want to use the generated param name in the same loop&lt;BR /&gt;
( mystring = "param_1" )&lt;BR /&gt;
(which does not work)
&lt;PRE&gt;	
i = 0
FOR i=1 TO 6 STEP 1
	mystring = 'param_' + str(i,1,0)

        if mystring = 1 Then
                            ! // code related to if checkbox is checked (TRUE/ON/1)
		else
                            ! // code related to if checkbox is NOT checked (FALSE/OFF/0)
		endif
NEXT i
&lt;/PRE&gt;
The code below&lt;B&gt; does &lt;/B&gt;work!!		
&lt;PRE&gt;	
i = 0
FOR i=1 TO 6 STEP 1
	mystring = 'param_' + str(i,1,0)

        UI_INFIELD mystrng, base_posx, base_posy, 20, 20

NEXT i
&lt;/PRE&gt;		&lt;BR /&gt;
&lt;BR /&gt;
Given that I can use the generated parameter name with the UI_INFIELD command, I figured there must be a way to use it in an IF statement.&lt;BR /&gt;
Could anyone point me in the right direction please?&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 Jun 2016 03:52:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Retrieving-parameter-value-with-parameter-name-as-string/m-p/288853#M8094</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-03T03:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving parameter value with parameter name as string</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Retrieving-parameter-value-with-parameter-name-as-string/m-p/288854#M8095</link>
      <description>Matrices are your friend in this situation. You can't use a loop to create a variable name (as you can in other languages), but you can populate and query / test the contents of a matrix.&lt;BR /&gt;
&lt;BR /&gt;
DIM arrayName[] is how you declare (or DIM arrayName[][] for a 2-dimension array)&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps.</description>
      <pubDate>Fri, 03 Jun 2016 07:30:26 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Retrieving-parameter-value-with-parameter-name-as-string/m-p/288854#M8095</guid>
      <dc:creator>Bruce</dc:creator>
      <dc:date>2016-06-03T07:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving parameter value with parameter name as string</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Retrieving-parameter-value-with-parameter-name-as-string/m-p/288855#M8096</link>
      <description>&lt;BLOCKQUOTE&gt;Bruce wrote:&lt;BR /&gt;Matrices are your friend in this situation. You can't use a loop to create a variable name (as you can in other languages), but you can populate and query / test the contents of a matrix.&lt;BR /&gt;
&lt;BR /&gt;
DIM arrayName[] is how you declare (or DIM arrayName[][] for a 2-dimension array)&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps.&lt;/BLOCKQUOTE&gt;

Thanks for this Bruce,&lt;BR /&gt;
Ended up following this advice and just passing all the values from the parameters into an array that could be looped through.&lt;BR /&gt;
&lt;BR /&gt;
It's a shame GDL can't handle parsing strings as param names, this work around works though!</description>
      <pubDate>Tue, 07 Jun 2016 02:30:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Retrieving-parameter-value-with-parameter-name-as-string/m-p/288855#M8096</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-07T02:30:27Z</dc:date>
    </item>
  </channel>
</rss>

