cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-880265%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EInput%20multipli%20per%20l'estrazione%20di%20dati%20SQL%20tramite%20script%20JMP.%3C%2FLINGO-SUB%3E%0A%20%20%3CLINGO-BODY%20id%3D%22lingo-body-880265%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%0A%20%20%20%3CP%3EHo%20uno%20script%20JSL%20che%20estrae%20dati%20da%20SQL.%20Attualmente%2C%20ho%20un%20elenco%20di%20numeri%20d'ordine%20in%20una%20tabella%20e%20lo%20uso%20per%20estrarre%20i%20dati%20di%20tutti%20gli%20ordini%20univoci%20del%20negozio.%3C%2FP%3E%20%0A%20%20%20%3CP%3E%3CSTRONG%3EVorrei%20aggiungere%20una%20funzione%20popup%20per%20inserire%20pi%C3%B9%20ordini.%20Sono%20riuscito%20a%20farlo%20per%20un%20ordine.%20Come%20posso%20aggiungere%20pi%C3%B9%20ordini%20in%20una%20finestra%20popup%3F%3C%2FSTRONG%3E%3C%2FP%3E%20%0A%20%20%20%3CBR%20%2F%3E%20%0A%20%20%20%3CP%3E%3CSTRONG%3EDi%20seguito%20%C3%A8%20riportato%20lo%20script%20che%20ho%20ideato.%3C%2FSTRONG%3E%3C%2FP%3E%20%0A%20%20%20%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0AClear%20Globals()%3B%0A%2F%2Fdt%20%3D%20current%20data%20table()%3B%0A%2F%2FSummarize(dt%2C%20uniq%20%3D%20By(%3AColumn%201))%3B%0A%2F%2Fsql_in%20%3D%20ConcatItems(uniq%2C%22%2C%22)%3B%0A%0A%2F%2F******************************%20Enter%20Leakage%20current%20below****************%0AShop%20Order%20%3D%20New%20Window(%20%22Enter%20Shop%20order%22%2C%0A%09%26lt%3B%0A%20%20%20%20%20%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%20%20%20%3CCODE%20class%3D%22%20language-jsl%22%3E%20%3CP%3E%3CSTRONG%3Elista.%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FCODE%3E%0A%20%20%3C%2FLINGO-BODY%3E%0A%20%20%3CCODE%20class%3D%22%20language-jsl%22%3E%0A%20%20%20%3CLINGO-LABS%20id%3D%22lingo-labs-880265%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%0A%20%20%20%20%3CLINGO-LABEL%3EAnalisi%20e%20modellazione%20dei%20dati%20di%20base%3C%2FLINGO-LABEL%3E%0A%20%20%20%3C%2FLINGO-LABS%3E%3C%2FCODE%3E%0A%20%0A%20%0A%20%20%3CLINGO-SUB%20id%3D%22lingo-sub-880285%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Input%20multipli%20per%20l'estrazione%20di%20dati%20SQL%20tramite%20script%20JMP.%3C%2FLINGO-SUB%3E%0A%20%20%3CLINGO-BODY%20id%3D%22lingo-body-880285%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%0A%20%20%20%3CP%3E%C3%88%20possibile%20utilizzare%20la%20casella%20di%20modifica%20del%20testo%20e%20quindi%20analizzare%20l'input%20dell'utente%20(utilizzare%20la%20funzione%20%26lt%3B%26lt%3B%20set%20o%20analizzarla%20dopo%20aver%20ottenuto%20il%20risultato)%3C%2FP%3E%20%0A%20%20%20%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Anw%20%3D%20New%20Window(%22Enter%20Shop%20order%22%2C%0A%09%26lt%3B%0A%20%20%20%20%20%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%20%20%20%3CCODE%20class%3D%22%20language-jsl%22%3E%20%3CP%3EOppure%20puoi%20aggiungere%20il%20pulsante%20%2B%20per%20aggiungere%20pi%C3%B9%20caselle%20di%20modifica%20dei%20numeri%3C%2FP%3E%20%3C%2FCODE%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Anw%20%3D%20New%20Window(%22Enter%20Shop%20order%22%2C%0A%09%26lt%3B%0A%20%20%20%20%20%20%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%20%3CP%3Eoppure%20utilizzare%20la%20casella%20di%20modifica%20del%20numero%3C%2FP%3E%20%3C%2FCODE%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Anw%20%3D%20New%20Window(%22Enter%20Shop%20order%22%2C%0A%09%26lt%3B%0A%20%20%20%20%20%20%20%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%20%20%3C%2FLINGO-BODY%3E%0A%20%0A%20%0A%20%20%3CLINGO-SUB%20id%3D%22lingo-sub-880411%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Input%20multipli%20per%20l'estrazione%20di%20dati%20SQL%20tramite%20script%20JMP.%3C%2FLINGO-SUB%3E%0A%20%20%3CLINGO-BODY%20id%3D%22lingo-body-880411%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%0A%20%20%20%3CP%3EGrazie%20Jarmo%2C%3C%2FP%3E%20%0A%20%20%20%3CP%3ELa%20funzione%20della%20casella%20di%20modifica%20del%20testo%20ha%20funzionato%20alla%20grande.%3C%2FP%3E%20%0A%20%20%20%3CBR%20%2F%3E%20%0A%20%20%20%3CP%3EQuando%20inserisco%20pi%C3%B9%20numeri%20d'ordine%20nello%20stesso%20file%20e%20sostituisco%20lo%20spazio%20con%20%22%2C%22%20funziona%20correttamente.%3C%2FP%3E%20%0A%20%20%20%3CBR%20%2F%3E%20%0A%20%20%20%3CP%3EVoglio%20renderlo%20robusto.%20Come%20posso%20gestire%20l'input%20quando%20viene%20inserito%20verticalmente%3F%20(Mi%20serve%20quando%20copio%20un%20elenco%20da%20Excel).%3C%2FP%3E%20%0A%20%20%20%3CBR%20%2F%3E%20%0A%20%20%20%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ConfidenceOwl94_0-1750266043038.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ConfidenceOwl94_0-1750266043038.png%22%20style%3D%22width%3A%20327px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ConfidenceOwl94_0-1750266043038.png%22%20style%3D%22width%3A%20327px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F77047i80B162E390B146DA%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ConfidenceOwl94_0-1750266043038.png%22%20alt%3D%22ConfidenceOwl94_0-1750266043038.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%20%0A%20%20%20%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Anw%20%3D%20New%20Window(%22Enter%20Shop%20order%22%2C%0A%09%26lt%3B%0A%20%20%20%20%20%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%20%20%3C%2FLINGO-BODY%3E%0A%20%0A%20%0A%20%20%3CLINGO-SUB%20id%3D%22lingo-sub-880412%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Input%20multipli%20per%20l'estrazione%20di%20dati%20SQL%20tramite%20script%20JMP.%3C%2FLINGO-SUB%3E%0A%20%20%3CLINGO-BODY%20id%3D%22lingo-body-880412%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%0A%20%20%20%3CP%3EIl%20metodo%20migliore%20che%20ho%20trovato%20%C3%A8%20generalmente%20Regex%2C%20ma%20il%20modello%20dipende%20dal%20caso%20d'uso.%20In%20questo%20caso%20potresti%20semplicemente%20usare%20Collapse%20Whitespace%20%2B%20Words%3C%2FP%3E%20%0A%20%20%20%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Anw%20%3D%20New%20Window(%22Enter%20Shop%20order%22%2C%0A%09%26lt%3B%0A%20%20%20%20%20%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%20%20%20%3CCODE%20class%3D%22%20language-jsl%22%3E%20%3CBR%20%2F%3E%20%3CP%3EPotresti%20anche%20pulire%20l'input%20in%20modo%20che%20l'utente%20lo%20veda%20quando%20esegue%20il%20commit%20della%20modifica%3C%2FP%3E%20%3C%2FCODE%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Anw%20%3D%20New%20Window(%22Enter%20Shop%20order%22%2C%0A%09%26lt%3B%0A%20%20%20%20%20%20%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%20%20%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar

Multiple input for SQL data pull using JMP script.

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.

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?

 

Below is the script I came up with.

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",
	<<Modal,
	<<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")
	
]\")));;


list.

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Multiple input for SQL data pull using JMP script.

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

Names Default To Here(1);

nw = New Window("Enter Shop order",
	<<Modal,
	<<Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", <<Set N Lines(5), <<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, ", ")) << get keys;
sql_in = Concat Items(sql_in, ", ");

 

You could also clean the input in such a way that user will see it when they commit the change

Names Default To Here(1);

nw = New Window("Enter Shop order",
	<<Modal,
	<<Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", 
			<< set function(function({this},
				unique = Collapse Whitespace(this << get text);
				sql_in = Concat Items(Associative Array(Words(unique, ", ")) << get keys, ", ");
				this << set text(sql_in);
			))
			, << Set N Lines(5)
			, <<Set Width(200)
		),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

unique = nw["variablebox"];
-Jarmo

View solution in original post

3 REPLIES 3
jthi
Super User

Re: Multiple input for SQL data pull using JMP script.

You could use text edit box and then parse the user input (use either << set function or parse it after you have the result)

Names Default To Here(1);

nw = New Window("Enter Shop order",
	<<Modal,
	<<Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", << Set N Lines(2), << Set Width(200)),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

Or you could add + Button to add more number edit boxes

Names Default To Here(1);

nw = New Window("Enter Shop order",
	<<Modal,
	<<Return Result,
	V List Box(
		Text Box(" "),
		H List Box(align("top"),
			Button Box("+",
				lub << Append(Number Edit Box())
			),
			lub = Lineup Box(N Col(1),
				Number Edit Box()
			)			
		),
		Spacer Box(Size(0, 10)),
		Button Box("OK",
			inputs = (lub << XPath("//NumberEditBox")) << get;
		),
		Button Box("Cancel")
	)
);

or utilize number col edit box

Names Default To Here(1);

nw = New Window("Enter Shop order",
	<<Modal,
	<<Return Result,
	V List Box(
		Text Box(" "),
		H List Box(align("top"),
			Button Box("+",
				tb << Add Row({"Number", .})
			),
			tb = Table Box(
				ncb = Number Col Edit Box("Number", [.])
			)
		),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

-Jarmo

Re: Multiple input for SQL data pull using JMP script.

Thanks Jarmo,

Text edit box function worked great. 

 

When I enter multiple order number in a same raw and replace space with "," it worked fine. 

 

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.)

 

ConfidenceOwl94_0-1750266043038.png

Names Default To Here(1);

nw = New Window("Enter Shop order",
	<<Modal,
	<<Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", << Set N Lines(5), << Set Width(200)),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

Write( nw["variablebox"] );

unique = nw["variablebox"];

sql_in = Substitute( unique, " ", "," );
jthi
Super User

Re: Multiple input for SQL data pull using JMP script.

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

Names Default To Here(1);

nw = New Window("Enter Shop order",
	<<Modal,
	<<Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", <<Set N Lines(5), <<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, ", ")) << get keys;
sql_in = Concat Items(sql_in, ", ");

 

You could also clean the input in such a way that user will see it when they commit the change

Names Default To Here(1);

nw = New Window("Enter Shop order",
	<<Modal,
	<<Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", 
			<< set function(function({this},
				unique = Collapse Whitespace(this << get text);
				sql_in = Concat Items(Associative Array(Words(unique, ", ")) << get keys, ", ");
				this << set text(sql_in);
			))
			, << Set N Lines(5)
			, <<Set Width(200)
		),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

unique = nw["variablebox"];
-Jarmo

Recommended Articles