Choose Language Hide Translation Bar
Highlighted
lukasz
Level III

Displaying of previous selections in Check Box

Hello Everybody,
I have this simple selection list where I choose some process. Next to that I have check box where
I can select some other parameters. After confirming the selection with OK button, the chosen parameters are saved as combined string variable with comma delimiter. Is it possible, after selecting the previous process (for example in order to choose additional parameters from check box), to read previously saved parameters and display the selections again in the check box (in order to see immediately what has been previously chosen)? Additionally, the renewed saving of updated/changed selection should be also possible.

I would appreciate for hints and suggestions how to solve mentioned issue.
Thank you and best regards.

dt = New Table( "example",
	Add Rows( 3 ),
	New Column( "Process",
		Character( 16 ),
		"Nominal",
		Set Values( {"Process_1", "Process_2", "Process_3"} )
	),
	New Column( "Selected",
		Character( 16 ),
		"Nominal",
		Set Values( {} )
	)
);

New Window("Example",            
	H List Box(
		processes = {"Process_1", "Process_2", "Process_3"};
		//then display
		Panel Box("Process",
			process = List Box( processes, max selected( 1 ) ),
			Button Box( "OK", 
				process_selected = process << get selected ),
				//Write(process_selected[1])
			),
			Spacer Box(Size(20, 10)),
                    
            Panel Box("Parameters",
                params = Check Box({"parameter_1", 
									  "parameter_2", 
									  "parameter_3", 
									  "parameter_4" 								  
									  })
            ),
        ),       
       	Button Box("SAVE",
           	choice_parameters = params << Get Selected();
		),    	
);
//combine
combined = Concat Items(choice_parameters, ",");
//find row in "Process" column having selected process
r = dt << Get Rows Where( :Process == process_selected[1] );
dt:Selected[r] = combined; // Update value
2 REPLIES 2
Highlighted
txnelson
Super User

Re: Displaying of previous selections in Check Box

You can do just about anything you want in JSL.  So the question should not be CAN JSL do ???? but rather, how do you get JSL to do ????.

With minor changes, I think I changed your code enough to give you an idea of how to do what you asked. Make sure you take the time to study the Scripting Guide.

Names Default To Here( 1 );
dt = New Table( "example",
	Add Rows( 3 ),
	New Column( "Process", Character( 16 ), "Nominal", Set Values( {"Process_1", "Process_2", "Process_3"} ) ),
	New Column( "Selected", Character( 16 ), "Nominal", Set Values( {} ) )
);

New Window( "Example",
	H List Box(
		processes = {"Process_1", "Process_2", "Process_3"};
		//then display
		Panel Box( "Process",
			process = List Box( processes, max selected( 1 ) ),
			Button Box( "OK", process_selected = process << get selected ),
			Button Box( "show previous selection",
				If( Is Empty( r ),
					Dialog( "no previous selection has been made" ),
					Dialog( "Previous selection is:", dt:selected[r] )
				)
			)
				//Write(process_selected[1])
		);,
		Spacer Box( Size( 20, 10 ) ), 
                    
		Panel Box( "Parameters",
			params = Check Box( {"parameter_1", "parameter_2", "parameter_3", "parameter_4"} )
		), 

	),
	Button Box( "SAVE",
		choice_parameters = params << Get Selected();
		combined = Concat Items( choice_parameters, "," );
		//find row in "Process" column having selected process
		r = (dt << Get Rows Where( :Process == process_selected[1] ))[1];
		dt:Selected[r] = combined; // Update value
	), 

);
Jim
Highlighted
lukasz
Level III

Re: Displaying of previous selections in Check Box

Ok, thank you, I will process that further.

Article Labels

    There are no labels assigned to this post.