<?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 do I add prompt boxes for parameters when writing custom SQL expressions in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52645#M29809</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11217"&gt;@Joeystringer&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Here's an example of something you can run before initiating the query:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dlg = New Window("Parameter Specification", &amp;lt;&amp;lt; Modal,
	V List Box(
		Text Box("Please specify the value of lineID."),
		H List Box(
			Text Box("LineID: "),
			neb = Number Edit Box();
		),
		Button Box("OK", LineID = neb &amp;lt;&amp;lt; Get);
	)
);

Show(LineID);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This window just asks the user to enter a number into the number edit box.&amp;nbsp; The "OK" button gets the value in the box and saves it as "lineID" which you can use in your query.&amp;nbsp; The "&amp;lt;&amp;lt; Modal" option makes the window modal, which means the JMP will not execute the rest of the script that comes after the window until the user presses "OK".&lt;/P&gt;&lt;P&gt;I highly recommend you check out the Scripting Guide (Help &amp;gt; Books &amp;gt; Scripting Guide) to learn how to script dialogs if you want to do anything more complicated&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2018 15:59:48 GMT</pubDate>
    <dc:creator>cwillden</dc:creator>
    <dc:date>2018-03-06T15:59:48Z</dc:date>
    <item>
      <title>How do I add prompt boxes for parameters when writing custom SQL expressions</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52612#M29790</link>
      <description />
      <pubDate>Tue, 06 Mar 2018 03:19:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52612#M29790</guid>
      <dc:creator>Joeystringer</dc:creator>
      <dc:date>2018-03-06T03:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add prompt boxes for parameters when writing custom SQL expressions</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52613#M29791</link>
      <description>&lt;P&gt;I use ssrs a lot and am used to having parameters like @Sitename or @Date. I have several queries I use in other platforms, but I like to be able to put them in JMP. the issue I run into is that I don't know how to use the prompt box for my parameters when I do the custom sql. For example, how would I write this so that a box would appear asking for "Lineid"? they would be able to respond, and the query would run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM tblline&lt;/P&gt;&lt;P&gt;where tblline.lineid=@LineID;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 03:24:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52613#M29791</guid>
      <dc:creator>Joeystringer</dc:creator>
      <dc:date>2018-03-06T03:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add prompt boxes for parameters when writing custom SQL expressions</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52645#M29809</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11217"&gt;@Joeystringer&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Here's an example of something you can run before initiating the query:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dlg = New Window("Parameter Specification", &amp;lt;&amp;lt; Modal,
	V List Box(
		Text Box("Please specify the value of lineID."),
		H List Box(
			Text Box("LineID: "),
			neb = Number Edit Box();
		),
		Button Box("OK", LineID = neb &amp;lt;&amp;lt; Get);
	)
);

Show(LineID);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This window just asks the user to enter a number into the number edit box.&amp;nbsp; The "OK" button gets the value in the box and saves it as "lineID" which you can use in your query.&amp;nbsp; The "&amp;lt;&amp;lt; Modal" option makes the window modal, which means the JMP will not execute the rest of the script that comes after the window until the user presses "OK".&lt;/P&gt;&lt;P&gt;I highly recommend you check out the Scripting Guide (Help &amp;gt; Books &amp;gt; Scripting Guide) to learn how to script dialogs if you want to do anything more complicated&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 15:59:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52645#M29809</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-03-06T15:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add prompt boxes for parameters when writing custom SQL expressions</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52672#M29815</link>
      <description>&lt;P&gt;If you use the Query Builder it will build the prompts for you automatically using the "Prompt on Run" option in the filters area.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMPScreenSnapz183.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/9724i03740A0379DAF11E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JMPScreenSnapz183.png" alt="JMPScreenSnapz183.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;When you run the query the user will be prompted. No reason to build it yourself.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMPScreenSnapz184.png" style="width: 195px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/9725i9B49CFC78A2846D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JMPScreenSnapz184.png" alt="JMPScreenSnapz184.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 19:36:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52672#M29815</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2018-03-06T19:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add prompt boxes for parameters when writing custom SQL expressions</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52673#M29816</link>
      <description>&lt;P&gt;Yes. when I build the queries directly in JMP, I can get the prompts. My problem I have is when I take an existing query and put into the custom sql query, my prompts aren't available. For a simple query, the query builder in JMP works, but I have some fairly lengthy and complicated joins that I'm trying to not have to rebuild.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 19:41:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52673#M29816</guid>
      <dc:creator>Joeystringer</dc:creator>
      <dc:date>2018-03-06T19:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add prompt boxes for parameters when writing custom SQL expressions</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52674#M29817</link>
      <description>Can you show me this with the query included? I have tried to add the query, but when I put this in, I'm not sure what to put for the variable in the "Where" statement of the query.</description>
      <pubDate>Tue, 06 Mar 2018 19:42:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52674#M29817</guid>
      <dc:creator>Joeystringer</dc:creator>
      <dc:date>2018-03-06T19:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add prompt boxes for parameters when writing custom SQL expressions</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52759#M29878</link>
      <description>&lt;P&gt;I'm not sure I understand exactly what you'd like to see but here's the JSL generated from a&amp;nbsp;query like I showed above.&lt;/P&gt;
&lt;P&gt;Notice the Where() portion. It's pure JSL. There are no variables that you could stick in your Custom SQL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like your choices for effort are:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Writing&amp;nbsp;the JSL to build the prompts and figuring out how to insert the responses into your SQL; or,&lt;/LI&gt;
&lt;LI&gt;Converting the query to Query Builder and letting it prompt for you.&amp;nbsp;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I'm not sure which is more effort for you but converting to Query Builder seems more flexible and will give you more options in the long run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New SQL Query(
	Version( 130 ),
	Connection(
		connection_string
	),
	QueryName( "inventory" ),
	Select(
		Column( "warehouseid", "t1" ),
		Column( "sku", "t1" ),
		Column( "sku_description", "t1" ),
		Column( "quantityonhand", "t1" ),
		Column( "quantityonorder", "t1" )
	),
	From(
		Table( "inventory", Schema( "Sporting Goods By Stan" ), Alias( "t1" ) ),
		Table(
			"warehouse",
			Schema( "Sporting Goods By Stan" ),
			Alias( "t9" ),
			Join(
				Type( Left Outer ),
				EQ( Column( "warehouseid", "t9" ), Column( "warehouseid", "t1" ) )
			)
		),
		Table(
			"order_item",
			Schema( "Sporting Goods By Stan" ),
			Alias( "t6" ),
			Join(
				Type( Left Outer ),
				EQ( Column( "sku", "t6" ), Column( "sku", "t1" ) )
			)
		),
		Table(
			"sku_data",
			Schema( "Sporting Goods By Stan" ),
			Alias( "t8" ),
			Join(
				Type( Left Outer ),
				EQ( Column( "sku", "t8" ), Column( "sku", "t1" ) )
			)
		),
		Table(
			"retail_order",
			Schema( "Sporting Goods By Stan" ),
			Alias( "t7" ),
			Join(
				Type( Left Outer ),
				EQ( Column( "ordernumber", "t7" ), Column( "ordernumber", "t6" ) )
			)
		)
	),
	Where(
		In List(
			Column( "department", "t8" ),
			{"Water Sports"},
			UI(
				SelectListFilter(
					ListBox,
					Base(
						"Categorical",
						Prompt(
							"Select a department:",
							Character,
							PromptName( "t8.department_1" ),
							ValueSource(
								Column(
									"department",
									Alias( "department" ),
									Table(
										"sku_data",
										Schema( "Sporting Goods By Stan" )
									)
								)
							)
						)
					)
				)
			)
		)
	)
) &amp;lt;&amp;lt; Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 22:48:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-add-prompt-boxes-for-parameters-when-writing-custom-SQL/m-p/52759#M29878</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2018-03-07T22:48:30Z</dc:date>
    </item>
  </channel>
</rss>

