<?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 string to parameter name in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646169#M7329</link>
    <description>&lt;P&gt;Have you considered using an&amp;nbsp;&lt;EM&gt;array&amp;nbsp;&lt;/EM&gt;instead? Your naming suggests the concept of an array. Then you can just step the row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, what do you mean by "as value of that parameter"? They are empty or generated based on some naming logic? If you are using the naming you have suggested to generate values, even more reason to your an array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ling.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jan 2025 07:59:27 GMT</pubDate>
    <dc:creator>Lingwisyer</dc:creator>
    <dc:date>2025-01-15T07:59:27Z</dc:date>
    <item>
      <title>Convert string to parameter name</title>
      <link>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646168#M7328</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;I'm new in gdl programing and I need your help.&lt;/P&gt;&lt;P&gt;Is there any way to convert string into parameter name?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to generate variable names with "for loop" (cell_1_1, cell_1_2, cell_2_1, cell_2_2 and go on) and next use them to render text paragraphs as value of that parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 07:51:03 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646168#M7328</guid>
      <dc:creator>silvermat</dc:creator>
      <dc:date>2025-01-15T07:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to parameter name</title>
      <link>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646169#M7329</link>
      <description>&lt;P&gt;Have you considered using an&amp;nbsp;&lt;EM&gt;array&amp;nbsp;&lt;/EM&gt;instead? Your naming suggests the concept of an array. Then you can just step the row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, what do you mean by "as value of that parameter"? They are empty or generated based on some naming logic? If you are using the naming you have suggested to generate values, even more reason to your an array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ling.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 07:59:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646169#M7329</guid>
      <dc:creator>Lingwisyer</dc:creator>
      <dc:date>2025-01-15T07:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to parameter name</title>
      <link>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646173#M7330</link>
      <description>&lt;P&gt;I tried something like that:&lt;/P&gt;&lt;P&gt;Is array can handle it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;! Parametry podstawowe
dx = cell_width      ! Szerokość komórki
dy = cell_height     ! Wysokość komórki
define style{2} "JA_font_style_1" Arial, gs_font_size*5, 1
style "JA_font_style_1"
result = 1
! Rysowanie siatki tabeli
for r = 1 to row_num
    for c = 1 to col_num
        ! Pozycje wierzchołków komórki
        x1 = (c - 1) * dx
        y1 = (r - 1) * dy
        x2 = c * dx
        y2 = r * dy

        pen cell_pen

        poly2 4, 5,
            x1, -y1,
            x2, -y1,
            x2, -y2,
            x1, -y2

        ! Generowanie nazwy parametru
        param_name = "cell_" + str(c, 1, 0) + "_" + str(r, 1, 0)

        ! Pobranie wartości parametru za pomocą request
        content = ""
       	result = request("parameter", param_name, content)
		

        ! Jeśli parametr istnieje i ma wartość
        if  result &amp;lt; 1 &amp;amp; content = "" then
		        ! Tworzenie paragrafu
            paragraph "para_" + param_name 1, 0,
                0, 0, 1
                pen text_pen
                style "JA_font_style_1"
                ! Zapisujemy faktyczną wartość parametru
                 content
            endparagraph

            ! Tworzenie tekstbloku
            textblock "block_" + param_name 0, 7, 0, 1, 1, 0,
                "para_" + param_name
            ! Wyświetlenie tekstu w środku komórki
            richtext2 x1 + dx / 2, -y1 - dy / 2, "block_" + param_name
        endif

    next c
next r&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="silvermat_0-1736928926539.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/81908i3191B4BDABBE3B86/image-size/medium?v=v2&amp;amp;px=400" role="button" title="silvermat_0-1736928926539.png" alt="silvermat_0-1736928926539.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 08:15:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646173#M7330</guid>
      <dc:creator>silvermat</dc:creator>
      <dc:date>2025-01-15T08:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to parameter name</title>
      <link>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646180#M7331</link>
      <description>&lt;P&gt;So your user defines a table size, and your object draws said table and populates the cells with user defined values. Array type parameters can be used for this, and you can get it to populate to as many rows and columns as you want. Given your parameter values reflect the position within the table, it should be relatively simple to generate those too. You will also need to utilise the&amp;nbsp;&lt;STRONG&gt;GLOB_MODPAR_NAME&amp;nbsp;&lt;/STRONG&gt;command if you want the array size to be dynamic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*Actually, I'm not sure how you would STEP letters without resorting to manually relating each number to a letter.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 08:44:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646180#M7331</guid>
      <dc:creator>Lingwisyer</dc:creator>
      <dc:date>2025-01-15T08:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to parameter name</title>
      <link>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646191#M7333</link>
      <description>&lt;P&gt;You can not access parameters by string reference. GDL has no concept of that. It always needs to be by literal.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Some&lt;/EM&gt; commands allow the use of strings, but those commands are mostly in the UI (see the difference between &lt;CODE&gt;ui_infield{2}&lt;/CODE&gt; and &lt;CODE&gt;ui_infield{3}&lt;/CODE&gt; as an example).&lt;/P&gt;
&lt;P&gt;But in other contexts this is not possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;! cell_1 =&amp;gt; param with value of '1.5'
pname = "cell_1"
result = pname + 2.5
! ERROR&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here "pname" is just a string with the content of "cell_1". It is not a reference to the parameter with that name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest using variable sized Arrays as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 09:38:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Convert-string-to-parameter-name/m-p/646191#M7333</guid>
      <dc:creator>runxel</dc:creator>
      <dc:date>2025-01-15T09:38:58Z</dc:date>
    </item>
  </channel>
</rss>

