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
cheeny
Level II

How do I add and remove another H list to/from my V list box with button click?

Hi! I am new to JSL. 

 

I am trying to create an interactive script where in the user can add/remove an input with button click. 

Here's my script:

 

 

dlg1 = Dialog(
Vlist(
Hlist("First Name", name1 = Edit text(), Spacer(""), "Last Name", name2 = Edit text()),
Hlist("First Name", name1 = Edit text(), Spacer(""), "Last Name", name2 = Edit text()),
Hlist( add = button("Add"), del = button("Remove"))
));

please help :(

1 ACCEPTED SOLUTION

Accepted Solutions
gzmorgan0
Super User (Alumni)

Re: How do I add and remove another H list to/from my V list box with button click?

You need to learn more JSL basics.  The script you have uses the Dialog() function which is deprecated and difficult to use except for very simple dialogs. Also the display names are not unique (ambiguous). Below is the output of your current script as shown in the Log window. It would take a lot of scripting to get the results.

List( 9 elements ) assigned.
//:*/
dlg1
/*:
{name1 = "george", Spacer, name2 = "james", name1 = "harry", Spacer, name2 = "bloe",
Assign( add ), Assign( del ), Button( 1 )}

There are mutiple methods to meet your request. One is to create a display with the maximum number of entries and make them invisible until the Add button is pushed.  I attached a script, but unless you spend time learning more JSL, you will not be able to maintain it (that is it will break). This script uses expressions for the Add, Delete and Ok buttons.  It uses dynamic naming of the display boxes versus Set functions.

 

View solution in original post

1 REPLY 1
gzmorgan0
Super User (Alumni)

Re: How do I add and remove another H list to/from my V list box with button click?

You need to learn more JSL basics.  The script you have uses the Dialog() function which is deprecated and difficult to use except for very simple dialogs. Also the display names are not unique (ambiguous). Below is the output of your current script as shown in the Log window. It would take a lot of scripting to get the results.

List( 9 elements ) assigned.
//:*/
dlg1
/*:
{name1 = "george", Spacer, name2 = "james", name1 = "harry", Spacer, name2 = "bloe",
Assign( add ), Assign( del ), Button( 1 )}

There are mutiple methods to meet your request. One is to create a display with the maximum number of entries and make them invisible until the Add button is pushed.  I attached a script, but unless you spend time learning more JSL, you will not be able to maintain it (that is it will break). This script uses expressions for the Add, Delete and Ok buttons.  It uses dynamic naming of the display boxes versus Set functions.