<?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: How can you use Global Variables with Encrypted Scripts in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78598#M36481</link>
    <description>&lt;P&gt;Well, you and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;&amp;nbsp;are right that unchecking the "Use the Here namespace..." option in the add-in builder will resolve your specific issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I'm sure that &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;&amp;nbsp;would agree with me that&amp;nbsp;the better programming/scripting practice is to properly scope all variables as you reference them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "Use the Here namespace..." option is on by default in order to protect the global namespace from accidental corruption.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Oct 2018 17:47:18 GMT</pubDate>
    <dc:creator>Jeff_Perkinson</dc:creator>
    <dc:date>2018-10-10T17:47:18Z</dc:date>
    <item>
      <title>How can you use Global Variables with Encrypted Scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78576#M36470</link>
      <description>&lt;P&gt;Using an encrypted script in Jmp13, I would like to read up a pre-assigned global variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;With a standard script assign...&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a=0;
b=10;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Using an Encrypted script&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;if (IsEmpty(a)==1,a=5);  // DO NOTHING IF ITS NOT EMPTY
if (IsEmpty(b)==1,b=50);  // DO NOTHING IF ITS NOT EMPTY
Write(a);
Write(b);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Goal:&amp;nbsp; If the global variable is undefined, assign it in the encrypted script.&amp;nbsp; If the global variable is defined, use the defination.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works without encryption.&amp;nbsp; Also, after executing the encrypted script, I can see the assigned defaulted globals.&lt;/P&gt;&lt;P&gt;So, is it possible to use a global variable with an encrypted script?&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 16:17:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78576#M36470</guid>
      <dc:creator>MattH</dc:creator>
      <dc:date>2018-10-10T16:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can you use Global Variables with Encrypted Scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78584#M36474</link>
      <description>Clarification. The issue lies within using the encrypted script in an add-in.&lt;BR /&gt;Just confirmed that it works with encryption as a stand alone script.&lt;BR /&gt;So does the add-in operate on a different variable space? Odd, as I can see other variables from encrypted scripts in this add-in&lt;BR /&gt;Apologies for not debugging this completely.</description>
      <pubDate>Wed, 10 Oct 2018 17:04:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78584#M36474</guid>
      <dc:creator>MattH</dc:creator>
      <dc:date>2018-10-10T17:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can you use Global Variables with Encrypted Scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78587#M36476</link>
      <description>Further Clarification: The issue is not with encryption, but with the add-in. Using the jsl directly in the add in causes the same issue. The global variables are not seen by the add-in</description>
      <pubDate>Wed, 10 Oct 2018 17:13:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78587#M36476</guid>
      <dc:creator>MattH</dc:creator>
      <dc:date>2018-10-10T17:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can you use Global Variables with Encrypted Scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78590#M36477</link>
      <description>&lt;P&gt;I believe this is an issue of scoping and namespaces, and the fact that the add-in menu uses &lt;A href="https://www.jmp.com/support/help/14-1/local-namespaces.shtml" target="_self"&gt;Names Default to Here(1)&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're trying to reference variables you should always use a&amp;nbsp;&lt;A href="https://www.jmp.com/support/help/14-1/scoping-operators.shtml#515744" target="_blank"&gt;scoping operator&lt;/A&gt; to reference them. The scoping operator for global variables is ::.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

::a=0;

a=45;


if(::a==0, show("yes"));

if(here:a == 45, show("yes"));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Oct 2018 17:34:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78590#M36477</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2018-10-10T17:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can you use Global Variables with Encrypted Scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78591#M36478</link>
      <description>&lt;P&gt;ANSWER ==&amp;gt; Un click the "Use the "Here" namespace for unqualified JSL variable names&lt;/P&gt;&lt;P&gt;It works for standard add-in script and for encrypted scripts.&lt;/P&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="Un select:  Use the &amp;quot;Here&amp;quot; namespace" style="width: 877px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12749i5EE14573545AB8C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="ANSWER.png" alt="Un select:  Use the &amp;quot;Here&amp;quot; namespace" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Un select:  Use the "Here" namespace&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 17:34:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78591#M36478</guid>
      <dc:creator>MattH</dc:creator>
      <dc:date>2018-10-10T17:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: How can you use Global Variables with Encrypted Scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78592#M36479</link>
      <description>&lt;P&gt;I think this will get you close to the answer; it looks like the default is to use the Here namespace in an addin, so you might need to use global:a rather than a&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="checked by default" style="width: 833px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12750i3490BC28FF02B0AE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="checked by default" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;checked by default&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 17:36:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78592#M36479</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2018-10-10T17:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can you use Global Variables with Encrypted Scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78593#M36480</link>
      <description>Jeff, thanks for the confirmation. Yes, I agree. It's a scoping issue. However, the solution is to uncheck that box in the add-in. This allows the outside script to set a global, and the internal add-in to use it. I wish I could have found that in one of the guides. Oh well.</description>
      <pubDate>Wed, 10 Oct 2018 17:37:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78593#M36480</guid>
      <dc:creator>MattH</dc:creator>
      <dc:date>2018-10-10T17:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can you use Global Variables with Encrypted Scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78598#M36481</link>
      <description>&lt;P&gt;Well, you and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;&amp;nbsp;are right that unchecking the "Use the Here namespace..." option in the add-in builder will resolve your specific issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I'm sure that &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;&amp;nbsp;would agree with me that&amp;nbsp;the better programming/scripting practice is to properly scope all variables as you reference them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "Use the Here namespace..." option is on by default in order to protect the global namespace from accidental corruption.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 17:47:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-you-use-Global-Variables-with-Encrypted-Scripts/m-p/78598#M36481</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2018-10-10T17:47:18Z</dc:date>
    </item>
  </channel>
</rss>

