cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
kachveder
Level III

JMP Alert: Subscript Range at row 66 in access or evaluation of 'selected_pqa[/*###*/i]', selected_pqa[/*###*/i]

Hi JMP community, 

 

I am having another issue with JMP scripting that is giving me the following error, even though I am getting the resulting output (charts and test results) I need: 

 

kachveder_0-1700230672403.png

 

Here is a partial JSL script that I think the problem lies: 

nw2 = New Window( "Select PQAs",
					<<Modal,
					Text Box("Set PQA(s):"),
					variablebox1_pqa = Check Box( unique_pqa ),
					H List Box(
						variablebox1_pqa_all = Check Box(
							" ",
							<<SetFunction( 
								function({this},
									variablebox1_pqa << Set All( this << Get, run script( 1 ) )
								)
							)
						),
						Text Box(
							"Select All PQAs",
							<<Set Width( 90 ),
							<<Set Wrap( 90 )
						)
					),
					H List Box(
					//get all saved variable values when the user 
					//selects the OK button from the menu
						Button Box( "OK", 
							answers = Eval List({
							selected_pqa = variablebox1_pqa << get selected			
							});
						//	nw << close window;
						),
						Button Box( "Cancel")
					), 
					//change popup window size
					<<Size Window(600,600)
				);

// If cancel or red X was clicked, stop the script
If( nw2 == {Button( -1 )}, Stop() );


/////////////////////////////////////////////////////////////
//Production of Output
/////////////////////////////////////////////////////////////

//initialize a jmp report window
nw= New Window("JMP report results for each PQA",
    container = V List Box()
);

//loop through each PQA and paste results into the 
//initialized jmp report window at each iteration. 
for (i = 1, i <= N Items(unique_pqa), i++,
	content = V List Box(
		pqa_val = selected_pqa[i];
		dt << Select Where(:PQA == pqa_val);
		
		//subset the selected data, but make subset data table pop-up invisible
		listDT = dt << Subset(invisible,
			output table name( "Subset where PQA is " || pqa_val ),
			Selected rows only ( 1 ),
			Selected columns only( 1 )
		);

This is the window where I can select PQAs, or all PQAs. I do not get the alert when I select all PQAs. I get the alert when I select a handful of PQAs. 

kachveder_1-1700231016533.png

Can you help me resolve this alert? 

Thank you. 

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
hogi
Level XI

Re: JMP Alert: Subscript Range at row 66 in access or evaluation of 'selected_pqa[/*###*/i]', selected_pqa[/*###*/i]

Please replace unique_pqa with selected_pqa in 

 

for (i = 1, i <= N Items(unique_pqa), i++,
	content = V List Box(
		pqa_val = selected_pqa[i];

 

Otherwise the index i will get higher than N Items(selected_pqa) - which leads to the error that you reported.

View solution in original post

txnelson
Super User

Re: JMP Alert: Subscript Range at row 66 in access or evaluation of 'selected_pqa[/*###*/i]', selected_pqa[/*###*/i]

I believe the issue is that you are looping in your For() loop, from 1 to N Items in unique_pqa, but you are doing your selection from selected_pqa.  If you have 10 items in your Check Box(), and you only select 2 of them, there will be 8 Select Where() calls that are not selecting, and therefore your susets will not run correctly.

Jim

View solution in original post

2 REPLIES 2
hogi
Level XI

Re: JMP Alert: Subscript Range at row 66 in access or evaluation of 'selected_pqa[/*###*/i]', selected_pqa[/*###*/i]

Please replace unique_pqa with selected_pqa in 

 

for (i = 1, i <= N Items(unique_pqa), i++,
	content = V List Box(
		pqa_val = selected_pqa[i];

 

Otherwise the index i will get higher than N Items(selected_pqa) - which leads to the error that you reported.

txnelson
Super User

Re: JMP Alert: Subscript Range at row 66 in access or evaluation of 'selected_pqa[/*###*/i]', selected_pqa[/*###*/i]

I believe the issue is that you are looping in your For() loop, from 1 to N Items in unique_pqa, but you are doing your selection from selected_pqa.  If you have 10 items in your Check Box(), and you only select 2 of them, there will be 8 Select Where() calls that are not selecting, and therefore your susets will not run correctly.

Jim