<?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 to replace the text in JSL thru User Interface(a dialog window) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-replace-the-text-in-JSL-thru-User-Interface-a-dialog/m-p/253912#M49850</link>
    <description>&lt;P&gt;I don't know if the subject name can be re-named.&lt;/P&gt;&lt;P&gt;Just for record: the subject should be - how to pass the JSL variable to SQL variable thru User Interface.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Mar 2020 07:15:17 GMT</pubDate>
    <dc:creator>steven_gong</dc:creator>
    <dc:date>2020-03-24T07:15:17Z</dc:date>
    <item>
      <title>How to replace the text in JSL thru User Interface(a dialog window)</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-the-text-in-JSL-thru-User-Interface-a-dialog/m-p/253353#M49727</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've been using SQL in my JSL, and declared 4 variables and set required value.(see below script)&lt;/P&gt;&lt;P&gt;What I want is to create a new window as user interface.. when run this JSL, pop up the window first to allow user to input different values for the variables.&lt;/P&gt;&lt;P&gt;For example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1st run JSL, user input: x,y,z,n for the 4 variables, to achieve the effect like below:&lt;/P&gt;&lt;P&gt;set @spec = 'x'&lt;BR /&gt;set @opn = 'y'&lt;BR /&gt;set @Loss = 'z'&lt;/P&gt;&lt;P&gt;set @day = n&lt;/P&gt;&lt;P&gt;2nd run JSL, user input: a,b,c,m for the 4 variables, to achieve the effect like below:&lt;/P&gt;&lt;P&gt;set @spec = 'a'&lt;BR /&gt;set @opn = 'b'&lt;BR /&gt;set @Loss = 'c'&lt;/P&gt;&lt;P&gt;set @day = m&lt;/P&gt;&lt;P&gt;=========================================&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;Names Default To Here( 1 );&lt;BR /&gt;ODBC = Create Database Connection( "___" );&lt;BR /&gt;SQL ="&lt;BR /&gt;declare @spec varchar(50)&lt;BR /&gt;declare @opn varchar(50)&lt;/P&gt;&lt;P&gt;declare @Loss varchar(50)&lt;BR /&gt;declare @day int&lt;BR /&gt;&lt;BR /&gt;set @spec = 'xxx'&lt;BR /&gt;set @opn = 'yyy'&lt;BR /&gt;set @Loss = 'zzz'&lt;/P&gt;&lt;P&gt;set @day = n&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select * from dt&lt;/P&gt;&lt;P&gt;''&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feel it difficult to me since I looked up the community, no found any clue on this.&lt;/P&gt;&lt;P&gt;So I'm make new discussion to ask for help.&lt;/P&gt;&lt;P&gt;Any help will be appreciated.&lt;/P&gt;&lt;P&gt;Looking forward to your help.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 08:21:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-the-text-in-JSL-thru-User-Interface-a-dialog/m-p/253353#M49727</guid>
      <dc:creator>steven_gong</dc:creator>
      <dc:date>2020-03-20T08:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace the text in JSL thru User Interface(a dialog window)</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-the-text-in-JSL-thru-User-Interface-a-dialog/m-p/253364#M49731</link>
      <description>&lt;P&gt;There are an unlimited ways to accomplish what you want.&amp;nbsp; Below is one simple interface, using your pseudo code.&amp;nbsp; You really need to read the Scripting Guide's sections on using Display Objects&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
nw = New Window( "Set Values",
	Lineup Box( N Col( 2 ),
		Text Box( "Set Spec" ),
		specCB = Combo Box( {"x", "y", "z", "n"}, specVal = specCB &amp;lt;&amp;lt; get Selected() ),
		Text Box( "Set opn" ),
		opnCB = Combo Box( {"x", "y", "z", "n"}, opnVal = opnCB &amp;lt;&amp;lt; get Selected() ),
		Text Box( "Set Loss" ),
		lossCB = Combo Box( {"x", "y", "z", "n"}, lossVal = lossCB &amp;lt;&amp;lt; get Selected() ),
		Text Box( "Set day" ),
		dayCB = Combo Box( {"x", "y", "z", "n"}, dayVal = dayCB &amp;lt;&amp;lt; get Selected() )
	),
	theOK = Button Box( "OK", 
		// Build the statements to be executed
		theExpr = "ODBC = Create Database Connection( \!"___\!" );
		SQL =\!"
		declare " || specVal || " varchar(50)
		declare " || opnVal || " varchar(50)
		declare " || lossVal || " varchar(50)
		declare " || dayVal || " int

		set " || specVal || " = 'xxx'
		set " ||  opnVal || " = 'yyy'
		set " || lossVal || " = 'zzz'
		set " || dayVal || " = n
		 
		select * from dt
		";
		show(theExpr);
		// run the expression (uncomment when code is real)
		//Eval( Parse( theExpr ) );
		
		nw &amp;lt;&amp;lt; close window;
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 10:02:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-the-text-in-JSL-thru-User-Interface-a-dialog/m-p/253364#M49731</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-03-20T10:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace the text in JSL thru User Interface(a dialog window)</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-the-text-in-JSL-thru-User-Interface-a-dialog/m-p/253872#M49849</link>
      <description>&lt;P&gt;Hi txnelson,&lt;/P&gt;
&lt;P&gt;Thanks very much for the guidance with complete script.&lt;/P&gt;
&lt;P&gt;I've learned the new window with combo box setting to create the user interface with defined variable.&lt;/P&gt;
&lt;P&gt;The tricky thing is how to use JSL variable to replace the SQL variable.&lt;/P&gt;
&lt;P&gt;I learned similar thing in below link:&amp;nbsp;&lt;LI-MESSAGE title="How to get content of text edit box into &amp;amp;quot;variable&amp;amp;quot;?" uid="189477" url="https://community.jmp.com/t5/Discussions/How-to-get-content-of-text-edit-box-into-quot-variable-quot/m-p/189477#U189477" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks to&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4550"&gt;@pmroz&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and I make my script work as expected.&lt;/P&gt;
&lt;P&gt;Here is my final scrip for information.&lt;/P&gt;
&lt;P&gt;==============================&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
specVal = "";
NW = New Window( "Input Spec",
	&amp;lt;&amp;lt;Modal, 
	&amp;lt;&amp;lt;Return Result,
	
	Text Box( "Set Spec" ),
	specCB = Combo Box( {"DA", "WB", "MOLD"} ), 
	//specCB = Text Edit Box( "WB" ),
	
	
	Button Box( "OK", specVal = specCB &amp;lt;&amp;lt; get selected() )
	//Button Box( "OK", specVal = specCB &amp;lt;&amp;lt; get text() )
				
);

If( specVal != "", 

	(ODBC = Create Database Connection( "___" ) ;
	SQL = Eval Insert(
		"
DECLARE @SPEC VARCHAR(50)
SET @SPEC = '^specVal^'
SELECT WL.ContainerName,WL.ProductName, WL.SPECNAME
   FROM A_WIPLOT WL
WHERE WL.SPECNAME LIKE CONCAT('%',@SPEC,'%')
ORDER BY WL.SPECNAME
"
	) ; 
	//show(SQL); to see the log to confirm if SQL statement meet the requirement
	DT = Execute SQL( ODBC, SQL, "SPEC_WIP" ) &amp;lt;&amp;lt; Maximize window ; 

	SUMMARY = DT &amp;lt;&amp;lt; Summary( Group( :SPECNAME ), Freq( "None" ), Weight( "None" ) ) ;
	Close Database Connection( ODBC ) ; 
	
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 11:28:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-the-text-in-JSL-thru-User-Interface-a-dialog/m-p/253872#M49849</guid>
      <dc:creator>steven_gong</dc:creator>
      <dc:date>2020-03-24T11:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace the text in JSL thru User Interface(a dialog window)</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-the-text-in-JSL-thru-User-Interface-a-dialog/m-p/253912#M49850</link>
      <description>&lt;P&gt;I don't know if the subject name can be re-named.&lt;/P&gt;&lt;P&gt;Just for record: the subject should be - how to pass the JSL variable to SQL variable thru User Interface.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 07:15:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-the-text-in-JSL-thru-User-Interface-a-dialog/m-p/253912#M49850</guid>
      <dc:creator>steven_gong</dc:creator>
      <dc:date>2020-03-24T07:15:17Z</dc:date>
    </item>
  </channel>
</rss>

