<?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: dropdown list of an array element not possible ? in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223838#M1431</link>
    <description>Ok got it&lt;BR /&gt;
&lt;BR /&gt;
It's a design problem, and something contrary to the data theory (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;to the extends that I understand it&lt;E&gt;&lt;/E&gt;).&lt;BR /&gt;
&lt;BR /&gt;
First you must understand that&lt;B&gt; you are mixing different data types in one parameters array, and that is a very bad idea in GDL&lt;/B&gt;, it's better to have multiple arrays, each for a distinctive type of data (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ie: one parameter array for integer values - real values - etc&lt;E&gt;&lt;/E&gt;), and by following GDL Styling recommendations it would be as following&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;iOpening_res[_i]			!&amp;lt;--for opening types (integer - array)
rOpening_res[_i]&lt;N&gt;		!&amp;lt;--for opening real data (real - array)
&lt;/N&gt;&lt;/PRE&gt;

&lt;BR /&gt;
second, if you follow the path I have just indicated, you would be able to use  @Joachim Suehlo solution (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;actually he have already told you that, but in fewer words&lt;E&gt;&lt;/E&gt;).&lt;BR /&gt;
&lt;BR /&gt;
third, on another side, if you followed the database theory (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;i.e.: no data entry should be repeated&lt;E&gt;&lt;/E&gt;), you will find that you have repeated yourself with tab_res[_i][6] column, while having tab_res[_i][4] and tab_res[_i][5] (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;that in your own words are used to length and height of a rectangle respectively&lt;E&gt;&lt;/E&gt;), and as a pro-tip subtitude tab_res[_i][6] by tab_res[_i][4] (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;or with tab_res[_i][5] &lt;E&gt;&lt;/E&gt;), and depending on iOpening_res[_i] values of a specific index, xyOpening_res[_i][4] can be the width of a rectangle or radius/diameter of a circle.&lt;BR /&gt;
&lt;BR /&gt;
forth cycling through parameter names in the way you have just shown us usually doesn't work (better said, never works in GDL)!&lt;BR /&gt;
and if worked, it would be prone to errors and makes code maintainability quite difficult.&lt;BR /&gt;
&lt;BR /&gt;
PS: Editied on 01/03/2020 for expression errors - "_i" was used instead of "i" because of forum's letter styling coding</description>
    <pubDate>Fri, 28 Feb 2020 16:32:30 GMT</pubDate>
    <dc:creator>Nader Belal</dc:creator>
    <dc:date>2020-02-28T16:32:30Z</dc:date>
    <item>
      <title>dropdown list of an array element not possible ?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223834#M1427</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;Hi,&lt;BR /&gt;
&lt;BR /&gt;
In my object I need to specify x,y and type of hole &lt;BR /&gt;
But there can be several holes&lt;BR /&gt;
So i store them in a two dimensional array&lt;BR /&gt;
tab_res[ i ][1]      type of hole (0 -&amp;gt; no hole, 1 -&amp;gt; rectangle, 2 -&amp;gt; round)&lt;BR /&gt;
tab_res[ i ][2]      x of the hole in object&lt;BR /&gt;
tab_res[ i ][3]      y of the hole in object&lt;BR /&gt;
tab_res[ i ][4]      width of hole if rectangle&lt;BR /&gt;
tab_res[ i ][5]      height of hole if rectangle&lt;BR /&gt;
tab_res[ i ][6]      diameter of hole if round&lt;BR /&gt;
&lt;BR /&gt;
so in the user interface i have fields to enter x, y width and height but for the type i would like a dropdown list instead of having to enter 0, 1 or 2&lt;BR /&gt;
since the value is in a INT array, the value has to be INT&lt;BR /&gt;
i saw we could associate STRINGs to INT using VALUES2&lt;BR /&gt;
And do a dropdown with UI_INFIELD{3} method 8&lt;BR /&gt;
&lt;BR /&gt;
so this is what i tried and no dropdown is appearing&lt;BR /&gt;
&lt;BR /&gt;
MASTER SCRIPT:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;NOHOLE = 0
RECTANGLE = 1
ROUND = 2
&lt;/PRE&gt;

Parameter script:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;for L = 1 to 4	
	values{2} "tab_res[" + str(L, 1, 0) + "][1]", NOHOLE , "No hole", RECTANGLE, "Rectangle", ROUND , "Round"
next L
&lt;/PRE&gt;

UI script: 
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;for L = 1 to 4
		UI_INFIELD{3} tab_res&lt;L&gt;[1], 130, var_ligne, 40, 20,
                    8, "", 0, 0, 0,0,0,0,
		    "","Sans",NOHOLE,
                    "",'Rectangle', RECTANGLE,
                    "","Round",ROUND
next L
&lt;/L&gt;&lt;/PRE&gt;

doing this the type field is still a numeric field, not a dropdown...&lt;BR /&gt;
help !&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 28 Feb 2020 14:17:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223834#M1427</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-28T14:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown list of an array element not possible ?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223835#M1428</link>
      <description>If I write instead
&lt;PRE&gt;values{2} "tab_res", NOHOLE , "No hole", RECTANGLE, "Rectangle", ROUND , "Round"&lt;/PRE&gt;
it works for me. I never used a VALUES or VALUES{2} for single Array-Parameter-Values and I think that this does not work.</description>
      <pubDate>Fri, 28 Feb 2020 15:39:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223835#M1428</guid>
      <dc:creator>Jochen Suehlo</dc:creator>
      <dc:date>2020-02-28T15:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown list of an array element not possible ?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223836#M1429</link>
      <description>&lt;BLOCKQUOTE&gt;Joachim wrote:&lt;BR /&gt;
If I write instead
&lt;PRE&gt;values{2} "tab_res", NOHOLE , "No hole", RECTANGLE, "Rectangle", ROUND , "Round"&lt;/PRE&gt;
it works for me. I never used a VALUES or VALUES{2} for single Array-Parameter-Values and I think that this does not work.
&lt;/BLOCKQUOTE&gt;

this can't work for me,&lt;BR /&gt;
in the 2D array&lt;BR /&gt;
each 1D array contains all necessary info for a hole,  (type of hole, x, y, width, height, diameter)&lt;BR /&gt;
 and each first element of each 1D array needs to be one from: "no hole" -&amp;gt; 0,   "rectangle" -&amp;gt; 1, "round" -&amp;gt; 2</description>
      <pubDate>Fri, 28 Feb 2020 15:57:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223836#M1429</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-28T15:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown list of an array element not possible ?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223837#M1430</link>
      <description>Wait a minute cause I have already solved a similar problem</description>
      <pubDate>Fri, 28 Feb 2020 16:05:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223837#M1430</guid>
      <dc:creator>Nader Belal</dc:creator>
      <dc:date>2020-02-28T16:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown list of an array element not possible ?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223838#M1431</link>
      <description>Ok got it&lt;BR /&gt;
&lt;BR /&gt;
It's a design problem, and something contrary to the data theory (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;to the extends that I understand it&lt;E&gt;&lt;/E&gt;).&lt;BR /&gt;
&lt;BR /&gt;
First you must understand that&lt;B&gt; you are mixing different data types in one parameters array, and that is a very bad idea in GDL&lt;/B&gt;, it's better to have multiple arrays, each for a distinctive type of data (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ie: one parameter array for integer values - real values - etc&lt;E&gt;&lt;/E&gt;), and by following GDL Styling recommendations it would be as following&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;iOpening_res[_i]			!&amp;lt;--for opening types (integer - array)
rOpening_res[_i]&lt;N&gt;		!&amp;lt;--for opening real data (real - array)
&lt;/N&gt;&lt;/PRE&gt;

&lt;BR /&gt;
second, if you follow the path I have just indicated, you would be able to use  @Joachim Suehlo solution (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;actually he have already told you that, but in fewer words&lt;E&gt;&lt;/E&gt;).&lt;BR /&gt;
&lt;BR /&gt;
third, on another side, if you followed the database theory (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;i.e.: no data entry should be repeated&lt;E&gt;&lt;/E&gt;), you will find that you have repeated yourself with tab_res[_i][6] column, while having tab_res[_i][4] and tab_res[_i][5] (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;that in your own words are used to length and height of a rectangle respectively&lt;E&gt;&lt;/E&gt;), and as a pro-tip subtitude tab_res[_i][6] by tab_res[_i][4] (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;or with tab_res[_i][5] &lt;E&gt;&lt;/E&gt;), and depending on iOpening_res[_i] values of a specific index, xyOpening_res[_i][4] can be the width of a rectangle or radius/diameter of a circle.&lt;BR /&gt;
&lt;BR /&gt;
forth cycling through parameter names in the way you have just shown us usually doesn't work (better said, never works in GDL)!&lt;BR /&gt;
and if worked, it would be prone to errors and makes code maintainability quite difficult.&lt;BR /&gt;
&lt;BR /&gt;
PS: Editied on 01/03/2020 for expression errors - "_i" was used instead of "i" because of forum's letter styling coding</description>
      <pubDate>Fri, 28 Feb 2020 16:32:30 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223838#M1431</guid>
      <dc:creator>Nader Belal</dc:creator>
      <dc:date>2020-02-28T16:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown list of an array element not possible ?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223839#M1432</link>
      <description />
      <pubDate>Fri, 28 Feb 2020 16:41:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/dropdown-list-of-an-array-element-not-possible/m-p/223839#M1432</guid>
      <dc:creator>Nader Belal</dc:creator>
      <dc:date>2020-02-28T16:41:58Z</dc:date>
    </item>
  </channel>
</rss>

