<?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: Multiple input for SQL data pull using JMP script. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Multiple-input-for-SQL-data-pull-using-JMP-script/m-p/880412#M104414</link>
    <description>&lt;P&gt;Best method I have come up with has generally been Regex but the pattern depends on your use case. In this case you could maybe just use Collapse Whitespace + Words&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Enter Shop order",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", &amp;lt;&amp;lt;Set N Lines(5), &amp;lt;&amp;lt;Set Width(200)),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

unique = Collapse Whitespace(nw["variablebox"]);
sql_in = Associative Array(Words(unique, ", ")) &amp;lt;&amp;lt; get keys;
sql_in = Concat Items(sql_in, ", ");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also clean the input in such a way that user will see it when they commit the change&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Enter Shop order",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", 
			&amp;lt;&amp;lt; set function(function({this},
				unique = Collapse Whitespace(this &amp;lt;&amp;lt; get text);
				sql_in = Concat Items(Associative Array(Words(unique, ", ")) &amp;lt;&amp;lt; get keys, ", ");
				this &amp;lt;&amp;lt; set text(sql_in);
			))
			, &amp;lt;&amp;lt; Set N Lines(5)
			, &amp;lt;&amp;lt;Set Width(200)
		),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

unique = nw["variablebox"];
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Jun 2025 17:26:52 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-06-18T17:26:52Z</dc:date>
    <item>
      <title>Multiple input for SQL data pull using JMP script.</title>
      <link>https://community.jmp.com/t5/Discussions/Multiple-input-for-SQL-data-pull-using-JMP-script/m-p/880265#M104398</link>
      <description>&lt;P&gt;I have a JSL script that pulls data from SQL. Currently, I have a list of order numbers in a table, and I am using that to pull data for all unique shop orders.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I would like to add a popup function to enter multiple shop orders. I was able to do that for one order. How can add multiple shop order in a pop up box?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Below is the script I came up with.&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
Clear Globals();
//dt = current data table();
//Summarize(dt, uniq = By(:Column 1));
//sql_in = ConcatItems(uniq,",");

//****************************** Enter Leakage current below****************
Shop Order = New Window( "Enter Shop order",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	Text Box( " " ),
	variablebox = Number Edit Box( ),
	Button Box( "OK" ),
	Button Box( "Cancel" )
);

Write( Shop Order["variablebox"] );

sql_in = Shop Order["variablebox"];

/********************Connection Strings*******************************/
TestDataConnString = 			"DRIVER=SQL Server; SERVER=X ; UID=X; PWD=X;				DATABASE=X";


eval(parse(evalinsert("\[ 

	A = Open Database(TestDataConnString, "SELECT 
	a.[ShopOrderId] ,[BuildSerialNumber] ,[DateCode] ,a.[ItemNumber], t4.ItemNumber AS PartNumber
    	,string_agg(a.[LotNumber],', ') AS Lots
	FROM [Employee].[dbo].[vw_LotQuery] a
	JOIN Employee.dbo.MFGTravelerShopOrders t2 with (NOLOCK) ON t2.ShopOrderID=a.ShopOrderId
    JOIN Employee.dbo.MFG_ItemMasters t4 with (NOLOCK) ON t4.ItemNumber=t2.ItemNumber
 
	WHERE 
		(a.[ShopOrderId] IN (^sql_in^))

		AND
		  (a.[ItemNumber] LIKE '%PM%' OR a.[ItemNumber] LIKE '%PW%')
	Group by a.[ShopOrderId] ,[BuildSerialNumber] ,[DateCode] ,a.[ItemNumber], t4.ItemNumber
	Order by [BuildSerialNumber]

	","Wafer Information")
	
]\")));;


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;list.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2025 01:47:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Multiple-input-for-SQL-data-pull-using-JMP-script/m-p/880265#M104398</guid>
      <dc:creator>ConfidenceOwl94</dc:creator>
      <dc:date>2025-06-18T01:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple input for SQL data pull using JMP script.</title>
      <link>https://community.jmp.com/t5/Discussions/Multiple-input-for-SQL-data-pull-using-JMP-script/m-p/880285#M104403</link>
      <description>&lt;P&gt;You could use text edit box and then parse the user input (use either &amp;lt;&amp;lt; set function or parse it after you have the result)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Enter Shop order",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", &amp;lt;&amp;lt; Set N Lines(2), &amp;lt;&amp;lt; Set Width(200)),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you could add + Button to add more number edit boxes&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Enter Shop order",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	V List Box(
		Text Box(" "),
		H List Box(align("top"),
			Button Box("+",
				lub &amp;lt;&amp;lt; Append(Number Edit Box())
			),
			lub = Lineup Box(N Col(1),
				Number Edit Box()
			)			
		),
		Spacer Box(Size(0, 10)),
		Button Box("OK",
			inputs = (lub &amp;lt;&amp;lt; XPath("//NumberEditBox")) &amp;lt;&amp;lt; get;
		),
		Button Box("Cancel")
	)
);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or utilize number col edit box&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Enter Shop order",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	V List Box(
		Text Box(" "),
		H List Box(align("top"),
			Button Box("+",
				tb &amp;lt;&amp;lt; Add Row({"Number", .})
			),
			tb = Table Box(
				ncb = Number Col Edit Box("Number", [.])
			)
		),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jun 2025 04:49:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Multiple-input-for-SQL-data-pull-using-JMP-script/m-p/880285#M104403</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-06-18T04:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple input for SQL data pull using JMP script.</title>
      <link>https://community.jmp.com/t5/Discussions/Multiple-input-for-SQL-data-pull-using-JMP-script/m-p/880411#M104413</link>
      <description>&lt;P&gt;Thanks Jarmo,&lt;/P&gt;
&lt;P&gt;Text edit box function worked great.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I enter multiple order number in a same raw and replace space with "," it worked fine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to make it robust. How can I handle the input when it is entered vertically.(I need this when I copy list from excel.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ConfidenceOwl94_0-1750266043038.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/77047i80B162E390B146DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ConfidenceOwl94_0-1750266043038.png" alt="ConfidenceOwl94_0-1750266043038.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Enter Shop order",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", &amp;lt;&amp;lt; Set N Lines(5), &amp;lt;&amp;lt; Set Width(200)),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

Write( nw["variablebox"] );

unique = nw["variablebox"];

sql_in = Substitute( unique, " ", "," );
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jun 2025 17:04:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Multiple-input-for-SQL-data-pull-using-JMP-script/m-p/880411#M104413</guid>
      <dc:creator>ConfidenceOwl94</dc:creator>
      <dc:date>2025-06-18T17:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple input for SQL data pull using JMP script.</title>
      <link>https://community.jmp.com/t5/Discussions/Multiple-input-for-SQL-data-pull-using-JMP-script/m-p/880412#M104414</link>
      <description>&lt;P&gt;Best method I have come up with has generally been Regex but the pattern depends on your use case. In this case you could maybe just use Collapse Whitespace + Words&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Enter Shop order",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", &amp;lt;&amp;lt;Set N Lines(5), &amp;lt;&amp;lt;Set Width(200)),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

unique = Collapse Whitespace(nw["variablebox"]);
sql_in = Associative Array(Words(unique, ", ")) &amp;lt;&amp;lt; get keys;
sql_in = Concat Items(sql_in, ", ");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also clean the input in such a way that user will see it when they commit the change&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Enter Shop order",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", 
			&amp;lt;&amp;lt; set function(function({this},
				unique = Collapse Whitespace(this &amp;lt;&amp;lt; get text);
				sql_in = Concat Items(Associative Array(Words(unique, ", ")) &amp;lt;&amp;lt; get keys, ", ");
				this &amp;lt;&amp;lt; set text(sql_in);
			))
			, &amp;lt;&amp;lt; Set N Lines(5)
			, &amp;lt;&amp;lt;Set Width(200)
		),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

unique = nw["variablebox"];
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jun 2025 17:26:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Multiple-input-for-SQL-data-pull-using-JMP-script/m-p/880412#M104414</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-06-18T17:26:52Z</dc:date>
    </item>
  </channel>
</rss>

