cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Woodrat
Level II

How to store a value entered into a text box as an object in JSL?

Okay, I'm stumped and have finally reconciled myself to the fact that I just don't know enough about JSL to do this on my own. I'm still fairly new to JSL, but I want to streamline things for folks I work with. I have a script built that is getting close to what I want, I just can't figure out how to have my row selection function use info manually typed into a text edit box.

 

The goal is to have a user hit a Journal button that will pop up a window with a text box they can enter info into. Then they'll be able to hit the button box directly below the edit field which will run a script to select rows that contain the text string they typed. I've pasted in what I have so far, but I know there's a disconnect with lines 6 and 9. My intention was to assign the text edit box input as an object but I think that's where I'm messing up. I just can't reconcile how to get the info typed into the text edit box into the row selection portion. Many thanks for any help!

 

Lot Identifier = New Window("Assay Identifier by Lot Tested",
Border Box( top( 10 ), bottom( 10 ), Left( 120 ), Right( 120 ),
vlistbox(
H Center Box(Text Box("Input Lot ID")),
Spacer Box(size(1,10)),
H list box( text box("Lot: "), ID=Text Edit Box()),
H Center Box(
Button Box("Select Rows with Lot Number", Current Data Table() << Row Selection(
Select where( Contains( :assay, ID ) ),
Match case( 0 ),
Dialog( Edit( Contains( Source Column( :assay ) ) ), Keep dialog open( 0 ) )
)))
)
)
)
8 REPLIES 8
Woodrat
Level II

Re: How to store a value entered into a text box as an object in JSL?

No idea why it's formatting the JSL like that, but here's just a straight copy/paste:

 

 

Lot Identifier = New Window("Assay Identifier by Lot Tested",
Border Box( top( 10 ), bottom( 10 ), Left( 120 ), Right( 120 ),
vlistbox(
H Center Box(Text Box("Input Lot ID")),
Spacer Box(size(1,10)),
H list box( text box("Lot: "), ID=Text Edit Box()),
H Center Box(
Button Box("Select Rows with Lot Number",Current Data Table() << Row Selection(
Select where( Contains( :assay, ID ) ),
Match case( 0 ),
Dialog( Edit( Contains( Source Column( :assay ) ) ), Keep dialog open( 0 ) )
)))
)
)
)

mzwald
Staff

Re: How to store a value entered into a text box as an object in JSL?

Several ways to do this.  Here is one:

New Window( "Example: Text Edit Box",
	Outline Box( "Enter a string", H List Box( Text Box( "String:" ), value = Text Edit Box( "" ) ) ),
);
 
txtValue = value << Get Text();
 
print(txtValue);

Use Number Edit Box() if you want to capture a number instead of text.  

Woodrat
Level II

Re: How to store a value entered into a text box as an object in JSL?

For some reason this isn't working for me. I'm wanting whatever is typed into the text box to then become the term that is used in the Row Selection() function. Still, I do appreciate the info. It very well could be that I'm just not implementing it correctly. I rearranged the formula to the following:

Assay Identifier = New Window( "Assay Identifier by Lot",
Border Box( top( 10 ), bottom( 10 ), Left( 120 ), Right( 120 ),
V List Box(
H Center Box( Text Box( "Input Lot ID" ) ),
Spacer Box( size( 1, 10 ) ),
H List Box( Text Box( "Lot: " ), Lot = Text Edit Box() ),
H Center Box( Button Box( "Select Assays By Lot", Lot ID = Lot << get text() ) )
)
)
);
Current Data Table() << Row Selection(
Select where(
Contains( :assay, Print( Lot ID ) ),
Dialog( Edit( Contains( Source Column( :assay ) ) ), Keep dialog open( 0 ) )
)
);

 

hogi
Level XII

Re: How to store a value entered into a text box as an object in JSL?

to enter JSL code, there is this button in the editor:

hogi_2-1727472733957.png

 


to edit a post, use the triangle on the right of the post and click on "Edit Reply":

hogi_1-1727472681564.png

 

 

Woodrat
Level II

Re: How to store a value entered into a text box as an object in JSL?

Yep, that's how I entered it in the first post. But when I hit "post" it got all screwy. I figured out the edit feature earlier today but figured it wasn't worth worrying about

Woodrat
Level II

Re: How to store a value entered into a text box as an object in JSL?

I was able to get it to work partially based on your input, @mzwald, so thanks again. The script below is what I've got and it just requires that I have two buttons instead of the one (which is kind of unfortunate). The first button assigns the text to an object, then the second executes the script that will identify rows that contain the text (stored as object). If I can figure out how to assign two functions to a button I'll be happy, but I at least have something that works for now.

 

Assay Identifier = New Window( "Assay Identifier by Lot",
	Border Box( top( 10 ), bottom( 10 ), Left( 120 ), Right( 120 ),
		V List Box(
			H Center Box( Text Box( "Input Lot ID" ) ),
			Spacer Box( size( 1, 10 ) ),
			H List Box( Text Box( "Lot: " ), Lot = Text Edit Box() ),
			H Center Box( Button Box( "Set", Lot ID = Lot << get text() ) ),
			H Center Box(
				Button Box( "Select", Current Data Table() << Row Selection( Select where( Contains( :assay, Lot ID ) ) ) )
			)
		)
	)
);
jthi
Super User

Re: How to store a value entered into a text box as an object in JSL?

You can just add everything inside same script within a button box. Just remember to "glue" them together with ;

 

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

Assay Identifier = New Window("Assay Identifier by Lot",
	Border Box(top(10), bottom(10), Left(120), Right(120),
		V List Box(align("Center"),
			Text Box("Input Lot ID", << Set Font Size(16)),
			Spacer Box(size(1, 10)),
			H List Box(
				Text Box("Lot: "), 
				Lot = Text Edit Box("", << Set Width(200), << Set N Lines(5))
			),
			Button Box("Select", 
				Lot ID = lowercase(lot << get text);
				If(!Is Missing(Lot ID),
					Current Data Table() << Row Selection(Select where(Contains(lowercase(:name), Lot ID)))
				)
			)
		)
	)
);

 

JMP Help page does have (some) good documentation regarding JSL. For example for the button box

 

And Scripting Index (from JMP's help menu) is highly useful after you get used to utilizing it (you might find this useful From Jarmo's desk: Using the Scripting Index as your JMP® search  for more efficient scripting index usage)

jthi_0-1727501382238.png

 

-Jarmo
Woodrat
Level II

Re: How to store a value entered into a text box as an object in JSL?

Thanks for that. I had tried getting the glue function to work last week but for some reason must have been having a brain fart. It's all good now :). Thanks to all who helped me get there!