<?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 apply variable to custom SQL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/how-to-apply-variable-to-custom-SQL/m-p/766209#M94624</link>
    <description>&lt;P&gt;in custom SQL, this works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;.....left join&amp;nbsp; c&lt;BR /&gt;on d.SCU = c.CU&lt;BR /&gt;where d.DE in (' 216532','216534')&lt;/P&gt;&lt;P&gt;in script, I define a variable: inString = ' 216532','216534'&lt;/P&gt;&lt;P&gt;then I like to run custom SQL:&lt;/P&gt;&lt;P&gt;.....left join&amp;nbsp; c&lt;BR /&gt;on d.SCU = c.CU&lt;BR /&gt;where d.DE in (' inString')&lt;/P&gt;&lt;P&gt;but i doesn't work. how do I use my variable in custom SQL correctly?&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jun 2024 02:00:03 GMT</pubDate>
    <dc:creator>ReliabilityWolf</dc:creator>
    <dc:date>2024-06-17T02:00:03Z</dc:date>
    <item>
      <title>how to apply variable to custom SQL</title>
      <link>https://community.jmp.com/t5/Discussions/how-to-apply-variable-to-custom-SQL/m-p/766209#M94624</link>
      <description>&lt;P&gt;in custom SQL, this works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;.....left join&amp;nbsp; c&lt;BR /&gt;on d.SCU = c.CU&lt;BR /&gt;where d.DE in (' 216532','216534')&lt;/P&gt;&lt;P&gt;in script, I define a variable: inString = ' 216532','216534'&lt;/P&gt;&lt;P&gt;then I like to run custom SQL:&lt;/P&gt;&lt;P&gt;.....left join&amp;nbsp; c&lt;BR /&gt;on d.SCU = c.CU&lt;BR /&gt;where d.DE in (' inString')&lt;/P&gt;&lt;P&gt;but i doesn't work. how do I use my variable in custom SQL correctly?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 02:00:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/how-to-apply-variable-to-custom-SQL/m-p/766209#M94624</guid>
      <dc:creator>ReliabilityWolf</dc:creator>
      <dc:date>2024-06-17T02:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to apply variable to custom SQL</title>
      <link>https://community.jmp.com/t5/Discussions/how-to-apply-variable-to-custom-SQL/m-p/766221#M94625</link>
      <description>&lt;P&gt;You can use &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/programming-functions.shtml?os=win&amp;amp;source=application#ww5012454" target="_self"&gt;Eval Insert()&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;inString = "'216532','216534'";

sql_template = "\[
	.....left join  c
on d.SCU = c.CU
where d.DE in (^inString^)
]\";

sql_str = Eval Insert(sql_template);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Jun 2024 04:52:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/how-to-apply-variable-to-custom-SQL/m-p/766221#M94625</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-17T04:52:26Z</dc:date>
    </item>
  </channel>
</rss>

