<?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 I use the text entered on textbox as variables on SQL? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/906434#M106488</link>
    <description>&lt;P&gt;get --&amp;gt; Get Text&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I was able to execute the changes mentioned above in JMP 19. I was able to achieve what I wanted. Thank you!!!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Oct 2025 05:06:58 GMT</pubDate>
    <dc:creator>TamedZebra</dc:creator>
    <dc:date>2025-10-08T05:06:58Z</dc:date>
    <item>
      <title>How can I use the text entered on textbox as variables on SQL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/904974#M106346</link>
      <description>&lt;P class="[&amp;amp;:not(&amp;amp;:first-child):has(strong)]:mt-1"&gt;I'm a beginner with application builders and I want to achieve the following: I'm currently retrieving data from a database using SQL with a specific time period. However, instead of directly modifying the SQL code to change the period, I want to be able to change it via a GUI. I'm currently executing this with JSL, and I want to replace the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;[HERE]&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;part of the SQL query.&lt;/P&gt;
&lt;P class="[&amp;amp;:not(&amp;amp;:first-child):has(strong)]:mt-1"&gt;Example JSL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Get a handle to the data table
dt = Current Data Table();

unique = Function({a}, // input: List, output: List
	{aa=Associative Array(),nr=NItems(a),i,aKeys,nUnique,aUnique={}},
	For( i=1, i&amp;lt;=nr, i++, aa &amp;lt;&amp;lt; insert( a[i] ) );
	aKeys = aa &amp;lt;&amp;lt; GetKeys;
	nUnique = NItems( aKeys );
	For( i = 1, i &amp;lt;= nUnique, i++, InsertInto(aUnique,aKeys[i]) );
	aUnique
);

dofun = Function({},{months,varName,dType},
	months = SampleRateInput &amp;lt;&amp;lt; Get;
	varName = VarList &amp;lt;&amp;lt; GetSelected;
	dType = Column(dt,varName[1]) &amp;lt;&amp;lt; GetDataType( "English");
	If(dType!="Character",
		Dialog(Title("Alert"),"Data Type of Variable should be Character.    ");
		Throw()
	);
	dt &amp;lt;&amp;lt; ClearSelect;
	dt &amp;lt;&amp;lt; SelectRows( selIdx );
);

OKButtonPress=Function({this},
	// This function is called when the OK button is pressed
	(thisModuleInstance &amp;lt;&amp;lt; Get Box) &amp;lt;&amp;lt; Close Window;
	dofun;
);


CancelButtonPress=Function({this},
	// This function is called when the Cancel button is pressed
	(thisModuleInstance &amp;lt;&amp;lt; Get Box) &amp;lt;&amp;lt; Close Window;
);


New SQL Query(
	Version( 130 ),
	Connection(	),
	QueryName(  ),
	Select(	),
	From(
		Table( ),
	),
	Where(
		Custom(
			"t1.msr_dt &amp;gt;= DATEADD(month, -[HERE], CURRENT_DATE)",
			UI( Custom( Base( "Continuous" ) ) )
		)
	)
) &amp;lt;&amp;lt; Run Foreground( UpdateTable( Current Data Table() ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Sep 2025 00:54:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/904974#M106346</guid>
      <dc:creator>TamedZebra</dc:creator>
      <dc:date>2025-09-30T00:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use the text entered on textbox as variables on SQL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/904982#M106347</link>
      <description>&lt;P&gt;My JMP is version 19.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2025 00:55:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/904982#M106347</guid>
      <dc:creator>TamedZebra</dc:creator>
      <dc:date>2025-09-30T00:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use the text entered on textbox as variables on SQL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/905030#M106349</link>
      <description>&lt;P&gt;Do you have your own custom GUI which you wish to use to change the value? Are you able to extract that value? I think you can just evaluate variables within Where(Custom()) block (at least with JMP18)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

myval = 150;

dt = New SQL Query(
	Version(130),
	Connection("JMP"),
	JMP Tables(["Big Class" =&amp;gt; "\C:\Program Files\JMP\JMPPRO\18\Samples\Data\Big Class.jmp"]),
	QueryName("SQLQuery2"),
	Select(Column("name", "t1")),
	From(Table("SQLQuery1", Alias("t1"))),
	Where(
		Custom(
			Eval Insert("t1.weight &amp;gt;= ^myval^"),
			UI(Custom(Base("Continuous"))))
		)
) &amp;lt;&amp;lt; Run Foreground;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Sep 2025 06:21:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/905030#M106349</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-09-30T06:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use the text entered on textbox as variables on SQL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/905034#M106351</link>
      <description>&lt;P class="[&amp;amp;:not(&amp;amp;:first-child):has(strong)]:mt-1"&gt;jthi-san, Arigatougozaimasu.&lt;/P&gt;
&lt;P class="[&amp;amp;:not(&amp;amp;:first-child):has(strong)]:mt-1"&gt;The GUI described in the JSL earlier was a slightly trimmed-down version of the sample application's JSL. The GUI I actually want to create is like the one in the attached image.&lt;/P&gt;
&lt;P class="[&amp;amp;:not(&amp;amp;:first-child):has(strong)]:mt-1"&gt;I understand that I can pass variables within SQL statements by enclosing them with '^'!&lt;/P&gt;
&lt;P class="[&amp;amp;:not(&amp;amp;:first-child):has(strong)]:mt-1"&gt;What JSL code should I write to execute a New SQL Query when the OK button in the GUI is pressed?&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GUI_idliketomake.png" style="width: 242px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/83926i0520AA8C1A827F61/image-size/large?v=v2&amp;amp;px=999" role="button" title="GUI_idliketomake.png" alt="GUI_idliketomake.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2025 06:37:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/905034#M106351</guid>
      <dc:creator>TamedZebra</dc:creator>
      <dc:date>2025-09-30T06:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use the text entered on textbox as variables on SQL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/905039#M106352</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/63644"&gt;@TamedZebra&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unrelated to the JSL side, but have you tried to apply the database &lt;A href="https://www.youtube.com/watch?v=Ftll1OvfK7s" target="_self"&gt;Query Builder&lt;/A&gt;? It provides a GUI that gives filters to change date ranges.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Ben&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2025 07:26:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/905039#M106352</guid>
      <dc:creator>Ben_BarrIngh</dc:creator>
      <dc:date>2025-09-30T07:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use the text entered on textbox as variables on SQL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/905044#M106353</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/51054"&gt;@Ben_BarrIngh&lt;/a&gt;&amp;nbsp;, Arigatougozaimasu.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is possible for us to save a script on a Data-table, and if the script is written 'SQL query', we can update the Data-table from Data-base by One-Click.&lt;/P&gt;
&lt;P&gt;But changing the SQL on the script or Query builder takes a little time and a little effort .&lt;/P&gt;
&lt;P&gt;So I woud like to edit SQL by GUI popping up by press a script on Data-table.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TamedZebra_0-1759218340235.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/83934i119F8C0D88E7D0E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TamedZebra_0-1759218340235.png" alt="TamedZebra_0-1759218340235.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2025 07:47:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/905044#M106353</guid>
      <dc:creator>TamedZebra</dc:creator>
      <dc:date>2025-09-30T07:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use the text entered on textbox as variables on SQL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/905807#M106417</link>
      <description>&lt;P&gt;I don't use application builder but rather write everything myself with JSL. This example application won't perform sql query to database but uses JMP table as the "database" and it is quite simplified version but it can give some general ideas&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

initval = 150;

run_query = Expr(
	months_to_query = neb_months &amp;lt;&amp;lt; get;
	dt = New SQL Query(
		Version(130),
		Connection("JMP"),
		JMP Tables(["Big Class" =&amp;gt; "\C:\Program Files\JMP\JMPPRO\18\Samples\Data\Big Class.jmp"]),
		QueryName("QueryMonths"),
		Select(Column("name", "t1")),
		From(Table("Big Class", Alias("t1"))),
		Where(
			Custom(
				Eval Insert("t1.weight &amp;gt;= ^months_to_query^"),
				UI(Custom(Base("Continuous"))))
			)
	) &amp;lt;&amp;lt; Run Foreground;
	wait(0);
	nw &amp;lt;&amp;lt; Close Window;
);

nw = New Window("Query Data",
	V List Box(
		Panel Box("How Long",
			Lineup Box(N Col(2),
				Text Box("Months: "),
				neb_months = Number Edit Box(initval),
			)
		),
		Lineup Box(N Col(2),
			Button Box("OK",
				run_query
			),
			Button box("Cancel",
				nw &amp;lt;&amp;lt; close window;
			)
		)
	)
);

Write();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Oct 2025 15:51:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/905807#M106417</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-10-03T15:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use the text entered on textbox as variables on SQL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/906434#M106488</link>
      <description>&lt;P&gt;get --&amp;gt; Get Text&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I was able to execute the changes mentioned above in JMP 19. I was able to achieve what I wanted. Thank you!!!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Oct 2025 05:06:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-use-the-text-entered-on-textbox-as-variables-on-SQL/m-p/906434#M106488</guid>
      <dc:creator>TamedZebra</dc:creator>
      <dc:date>2025-10-08T05:06:58Z</dc:date>
    </item>
  </channel>
</rss>

