<?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: UNDEFINED Array Values Question in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/UNDEFINED-Array-Values-Question/m-p/590378#M6396</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Joachim,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You are a genius! &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you, that worked perfectly and is most appreciated!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards, Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2024 22:59:52 GMT</pubDate>
    <dc:creator>GDL Enthusiast</dc:creator>
    <dc:date>2024-02-28T22:59:52Z</dc:date>
    <item>
      <title>UNDEFINED Array Values Question</title>
      <link>https://community.graphisoft.com/t5/GDL/UNDEFINED-Array-Values-Question/m-p/590374#M6394</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a problem that is baffling me. I have simplified it down to how to deal with an Undefined line item in an array. Here is the script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;FONT size="3"&gt;Parameter Script:&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;values{2} "bolt",             1, `Simple`,
                              2, `Complex`
values{2} "nut",              1, `Simple`,
                              2, ` Complex `&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The 2D Script has a variety of bolt and nut types using IF statements with text notes for bolt or nut type. For each a different text result is given, i.e.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;2D Script&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;IF Bolt = 1   THEN   TextA1 = "IN1 String to test the text."
IF Bolt = 2   THEN   TextA2 = "IN2 String to test the text."
IF Nut = 1    THEN   TextA3 = "IN3 String to test the text."
IF Nut = 2    THEN   TextA4 = "IN4 String to test the text."&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the user selects Bolt = 1 then TextA1 is defined, but&amp;nbsp;TextA2 is undefined causing an error in the following array:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DIM ItemText[4]
ItemText[1] = TextA1
ItemText[2] = TextA2
ItemText[3] = TextA3
ItemText[4] = TextA4

! Show Result
Text2 0,0,ItemText[1]
Text2 0,0.05,ItemText[2]
Text2 0,0.1,ItemText[3]
Text2 0,0.15,ItemText[4] &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I have tried this alternative code to handle the array using IF statements but I can't think of a way to write IF &lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;TextA1 = undefined THEN:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DIM ItemText[3]
IF TextA1 = "" THEN ItemText[1] = "" ELSE ItemText[1] = TextA1
IF TextA2 = "" THEN ItemText[2] = "" ELSE ItemText[2] = TextA2
IF TextA3 = "" THEN ItemText[3] = "" ELSE ItemText[3] = TextA3&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...etc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to make the array ignore undefined values?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Many thanks, Matt&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 11:14:28 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/UNDEFINED-Array-Values-Question/m-p/590374#M6394</guid>
      <dc:creator>GDL Enthusiast</dc:creator>
      <dc:date>2024-09-26T11:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: UNDEFINED Array Values Question</title>
      <link>https://community.graphisoft.com/t5/GDL/UNDEFINED-Array-Values-Question/m-p/590376#M6395</link>
      <description>&lt;DIV style="color: #3d3d3d; background-color: #fafafa; font-family: Menlo, Monaco, 'Courier New', monospace; font-weight: normal; font-size: 12px; line-height: 18px; white-space: pre;"&gt;
&lt;DIV&gt;&lt;SPAN&gt;ItemText&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt; is undefined because TEXTA2 is undefined in the default settings.&lt;/DIV&gt;
&lt;DIV&gt;The best way is to initialize all String Values before they are used.&lt;BR /&gt;If you do this at the top of the script, you will have no errors.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;LI-CODE lang="markup"&gt;TextA1 = ""
TextA2 = ""
TextA3 = ""
TextA4 = ""

IF Bolt = 1   THEN   TextA1 = "IN1 String to test the text."
IF Bolt = 2   THEN   TextA2 = "IN2 String to test the text."
IF Nut = 1    THEN   TextA3 = "IN3 String to test the text."
IF Nut = 2    THEN   TextA4 = "IN4 String to test the text."

DIM ItemText[4]
ItemText[1] = TextA1
ItemText[2] = TextA2
ItemText[3] = TextA3
ItemText[4] = TextA4&lt;/LI-CODE&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 28 Feb 2024 22:41:09 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/UNDEFINED-Array-Values-Question/m-p/590376#M6395</guid>
      <dc:creator>Jochen Suehlo</dc:creator>
      <dc:date>2024-02-28T22:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: UNDEFINED Array Values Question</title>
      <link>https://community.graphisoft.com/t5/GDL/UNDEFINED-Array-Values-Question/m-p/590378#M6396</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Joachim,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You are a genius! &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you, that worked perfectly and is most appreciated!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards, Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 22:59:52 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/UNDEFINED-Array-Values-Question/m-p/590378#M6396</guid>
      <dc:creator>GDL Enthusiast</dc:creator>
      <dc:date>2024-02-28T22:59:52Z</dc:date>
    </item>
  </channel>
</rss>

