<?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 How to make Associative Array to return key value for non-existing key? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-make-Associative-Array-to-return-key-value-for-non/m-p/892230#M105323</link>
    <description>&lt;P&gt;Folks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to make a default value in associated array dynamic?&lt;/P&gt;
&lt;P&gt;Meaning that if you try to access a key that does not exist, it returns not a static default value, but some lambda function, for instance - the key itself? Or key*2, or key||"_string".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Aug 2025 17:12:53 GMT</pubDate>
    <dc:creator>miguello</dc:creator>
    <dc:date>2025-08-04T17:12:53Z</dc:date>
    <item>
      <title>How to make Associative Array to return key value for non-existing key?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-make-Associative-Array-to-return-key-value-for-non/m-p/892230#M105323</link>
      <description>&lt;P&gt;Folks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to make a default value in associated array dynamic?&lt;/P&gt;
&lt;P&gt;Meaning that if you try to access a key that does not exist, it returns not a static default value, but some lambda function, for instance - the key itself? Or key*2, or key||"_string".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2025 17:12:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-make-Associative-Array-to-return-key-value-for-non/m-p/892230#M105323</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2025-08-04T17:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to make Associative Array to return key value for non-existing key?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-make-Associative-Array-to-return-key-value-for-non/m-p/892240#M105324</link>
      <description>&lt;P&gt;I don't think you can make the returned value dynamic.&amp;nbsp;You could use Try(), but I think a function could be better option to handle the missing values&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
ex = Associative Array({"red", "blue"}, {1, 2});

Try(ex["green"], "green");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Aug 2025 17:23:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-make-Associative-Array-to-return-key-value-for-non/m-p/892240#M105324</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-08-04T17:23:12Z</dc:date>
    </item>
  </channel>
</rss>

