<?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: JMP and SQL queries in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-and-SQL-queries/m-p/370197#M61994</link>
    <description>&lt;P&gt;Hello Stas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can concat your SQL code snippets as you like. I have two samples to give you an idea how to solve your problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;OrderNumber = 12345;

text_block_DB_0 = "select  t1.*  from DB1 t1";

if(selection_button, // can be a choice of the user
	text_block_DB_1 = " and t1.[time]=(select max(t2.[time]) from DB1 t2 where t1.[SN] = t2.[SN])"; // get the laste entry of a serial number dependend of time)
	,
	text_block_DB_1 = ""; // gives all SN
)

dt = Open Database(__DSN_String,text_block_DB_0 || " where t1.[Order] = " || char(OrderNumber) || text_block_DB_1);


OrderNumber = 12345;

text_block_DB_0 = "select  t1.*  from DB1 t1 where t1.[Order] = *insert_order_number* ";

if(selection_button,
	text_block_DB_1 = " and t1.[time]=(select max(t2.[time]) from DB1 t2 where t1.[SN] = t2.[SN])";
	,
	text_block_DB_1 = "";
)

dt = Open Database(__DSN_String,substitute(text_block_DB_0,"*insert_order_number*", char(OrderNumber)) || text_block_DB_1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 22 Mar 2021 07:16:40 GMT</pubDate>
    <dc:creator>Mauro_Gerber</dc:creator>
    <dc:date>2021-03-22T07:16:40Z</dc:date>
    <item>
      <title>JMP and SQL queries</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-and-SQL-queries/m-p/370060#M61984</link>
      <description>&lt;P&gt;Hey guys, I have two related questions that would be great if I'll find a solution to:&lt;BR /&gt;1. is there a&amp;nbsp; way that JMP can alter a field in SQL query? I mean that I wish to run JSL code that will ask from a user the date range (for example), it will update it into the relevant field in my SQL query and will run this query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Is it possible to create JSL code that will ask from the user if to run X query or Y query and based on the answer it will run the chosen query?&lt;BR /&gt;&lt;BR /&gt;For both questions, right now my code runs queries that been converted to BAT files (used to work with EXE files but SQL no longer supports it as standard.&lt;BR /&gt;Run button example:&lt;BR /&gt;Button Box("xx",&lt;BR /&gt;&lt;BR /&gt;open("\\VMSPFSFSLC01\F28_PLI\SQL\FE SQL\xx.bat")&lt;BR /&gt;),&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:27:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-and-SQL-queries/m-p/370060#M61984</guid>
      <dc:creator>Stas</dc:creator>
      <dc:date>2023-06-10T23:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: JMP and SQL queries</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-and-SQL-queries/m-p/370096#M61988</link>
      <description>&lt;P&gt;May be you want to have a look at a recent paper:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discovery-Summit-Europe-2021/Strategies-and-Examples-for-Data-Acquisition-From-Distributed/ta-p/349225" target="_blank"&gt;Strategies and Examples for Data Acquisition From Distributed and Complex Source... - JMP User Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In the video you find, how it works, and in the journal you find all scripts working with Big Class.jmp sample table.&lt;/P&gt;&lt;P&gt;But pretty much the same works also on ODBC connections for databases.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Mar 2021 08:28:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-and-SQL-queries/m-p/370096#M61988</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2021-03-21T08:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: JMP and SQL queries</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-and-SQL-queries/m-p/370197#M61994</link>
      <description>&lt;P&gt;Hello Stas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can concat your SQL code snippets as you like. I have two samples to give you an idea how to solve your problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;OrderNumber = 12345;

text_block_DB_0 = "select  t1.*  from DB1 t1";

if(selection_button, // can be a choice of the user
	text_block_DB_1 = " and t1.[time]=(select max(t2.[time]) from DB1 t2 where t1.[SN] = t2.[SN])"; // get the laste entry of a serial number dependend of time)
	,
	text_block_DB_1 = ""; // gives all SN
)

dt = Open Database(__DSN_String,text_block_DB_0 || " where t1.[Order] = " || char(OrderNumber) || text_block_DB_1);


OrderNumber = 12345;

text_block_DB_0 = "select  t1.*  from DB1 t1 where t1.[Order] = *insert_order_number* ";

if(selection_button,
	text_block_DB_1 = " and t1.[time]=(select max(t2.[time]) from DB1 t2 where t1.[SN] = t2.[SN])";
	,
	text_block_DB_1 = "";
)

dt = Open Database(__DSN_String,substitute(text_block_DB_0,"*insert_order_number*", char(OrderNumber)) || text_block_DB_1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Mar 2021 07:16:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-and-SQL-queries/m-p/370197#M61994</guid>
      <dc:creator>Mauro_Gerber</dc:creator>
      <dc:date>2021-03-22T07:16:40Z</dc:date>
    </item>
  </channel>
</rss>

